I have been trying to set up a java environment on a windows system. I have downloaded the SDK and set my classpath and path variables. I can compile my code no problem but get a problem when i try to run the programs. I get the following error "Error: Could not open 'C:\Program Files\Java\j2re1.4.1_01\lib\i386\jvm.cfg'". I assumed that windows is looking for the JVM in this directory but cannot find it because its not there. My question is why is windows looking is this directory and not the directory I have set in my PATH variable? and can I change this? If not how do I fix the problem?
Simple answer: because windows suck. Start regedit, go to HKLM/Software/JavaSoft/Java Runtime Environment/ and find value CurrentVersion. I have 1.4 there. Then there should be some subkeys, one of them will be the one found in "CurrentVersion". Check the paths in there.
Now if any of the subsection match the reality, you can change the "CurrentVersion" to the name of that section. Otherwise you can try modifying the paths in the "CurrentVersion" section to the paths you would like to see there (maybe C:/j2sdk1.4.2_03/jre/...).
And finally: I will accept no responsibility whatsoever for any damage made by following the instructions above.
it's not Windows that sucks (please keep your anti-Microsoft zealotness comments on /. where they belong). This looks like a misconfiguration issue resulting from something going wrong during JRE installation (which is part of the J2SDK installation which is a Sun product built around a product created by InstallShield corporation so no Microsoft involvement at all).
The JRE is installed as standard in the location you mentioned even if you set the SDK installation path to something else.