2

I have installed Java 8 and set my JAVA_HOME and JRE_HOME paths and added %JAVA_HOME% to the start of the path variable.

I created a helloworld.java application and am able to compile it using:

javac helloworld.java

However, when I try to run:

java helloworld

I get the error:

The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe

How can I solve this?

5
  • Try this thing. It's the same error. You should create a links. Try this advice! Commented Oct 26, 2015 at 21:00
  • Have you installed just java or the JDK (Java Development Kit) as well? Commented Oct 26, 2015 at 21:01
  • I installed just the JDK? Commented Oct 26, 2015 at 21:02
  • in system variables section check the path variable that is there C:\ProgramData\Oracle\Java\javapath path in it Commented Oct 26, 2015 at 21:04
  • I added it and it hasnt solved it? Commented Oct 26, 2015 at 21:55

4 Answers 4

5

1.Just go to C:\ProgramData\Oracle\Java\javapath\

2.You will find there shortcuts for java.exe,javaw.exe,javaws.exe which are pointing to a location where they actually are not existing now

3.Go to the jre location where you have installed java like C:\Program Files\Java\jre6\bin

  1. You will find java.exe,javaw.exe,javaws.exe

  2. Create shortcuts for these files and replace with the ones which are present in C:\ProgramData\Oracle\Java\javapath.

It works

Sign up to request clarification or add additional context in comments.

1 Comment

It was the only solution that worked for me. Thanks
3

Just set %JAVA_HOME%/bin to your path variable.

2 Comments

Obviously you work with Windows. Be sure to exit and restart your console after configuring the path in your system properties. - Do you like to give us your path (set path)?
Thank you I have solved the issue now. I had set the JDK_HOME and JRE_HOME vars to the wrong path. I have included an answer stating the paths that I used.
0

If you are blocked from modifying system variables from command line, but are able to open up an elevated command prompt, then run a command like this:

setx \M JAVA_HOME "C:\Program Files\Java\jdk1.8.0_25"

But of course, change the directory to point to your installed version of java. Note that the JAVA_HOME path does not point into the bin directory, it stops one level above bin.

Comments

-1

I was able to solve this issue. To do so I used the advice from this answer:

Java SE Development Kit 8u25 on a 64-bit Windows 8

Set the following user environment variables (== environment variables of type user variables)

•JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
•JDK_HOME  : %JAVA_HOME%
•JRE_HOME  : %JAVA_HOME%\jre
•CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
•PATH      : your-unique-entries;%JAVA_HOME%\bin 

(make sure that the longish your-unique-entries does not contain any other references to another Java installation folder.)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.