Java path..Error of jvm.cfg

Can anyone please tell me why I get the following error when I try to run my Java programs? The programs get compiled successfully but are not able to be run. I have already set the path of Java.

C:\JavaServ>javac hello1.java
C:\JavaServ>java hello1
Error: could not open C:\Program Files\Java\jre6\lib\amd64\jvm.cfg

Solution 1:

Don't think if this is a correct way...(perhaps proper installation of Java is a permanent solution)....but this is a trick..:)

Delete the “java.exe” file from “c:\windows” and “c:\windows\system32″. That should fix it.

Solution 2:

this should be an internal file of JRE and in general you shouldn't deal with it when you're running/compiling java.

Here you can find an explanation of what exactly this file is intended for. Bottom line, your Java installation is somehow corrupted, so as a first resort to resolve this issue, I suggest you to re-install jre.

You should ensure that you're installing the right jre for your architecture.

Hope, this helps

Solution 3:

In case you get here and scroll this far down, the newer Oracle versions of Java x86 and probably also x64 are horribly broken. You may find that after removing all versions of Java, and even manually deleting all the versions you find in c:/program files/ and c:/program files (x86)/ that you still can't properly run a fresh install of Java.

I'm here to tell you why, and how to fix it.

Go to C:\Program Files\Common Files\ and DELETE the Oracle directory. It has a version of Java underneath it inside a junction (symlink) that is sequestered away from all your other installs. Bastards.

Now, also go to System Properties -> Advanced -> Environment Variables and edit the PATH under System Variables. Find the place where the Oracle folder is referenced, and delete it. Close all your windows down, reboot to be extra sure if you want.

Install the JRE or JDK. Open a command prompt and type 'java' and if it comes up, you're golden. If not, go back to the PATH variable and add "C:\Program Files (x86)\Java\jdk1.8.0_221\bin" or whatever looks right for your machine.

I hate Oracle.

Solution 4:

You can not Uninstall/Reinstall JRE if you are having this error. That's why because previous installation has copied 3 files namely Java.exe, Javaw.exe, javaws.exe in the c:/windows/system32 folder. Simply go there and remove these files and download a fresh version of jre from oracle and install it. I will prefer JDK 1.6 update 45. Which is very stable.

Solution 5:

update registry path to installation location

This happened for me when I moved out my default installation from an overcrowded primary partition to another location. Fir