Making java work

novahifi

Baseband Member
Messages
98
I have installed java development kit onto this computer, but it doesn't work when I go into the command prompt and enter that javac etc. command that should make it execute my java programs in notepad.

I'm using windows XP, but the computer that is connected to the internet does not have service pack 2 because for an unknown reason downloading service pack 2 always stops the monitor from displaying all but 16 colours. Could not having the service pack stop java working? Are there any other programs or accessories I need to download or buy apart from the free java development kit? Is there any program that can make it possible for ALL the results of my work (including pictures) to be displayed? Are there any special preliminary instructions to be entered into the command prompt?

Thank you, any help on this is very much appreciated.
 
Try looking into the environment variables for java...they may not be setup properly, so windows is unable to find the compiler.
 
On the site it instructs XP users to change the environment variables by clicking on the control panel icon for java and then clicking on the "advanced" tab and subsequently clicking the environment variable button - I checked on that "advanced" tab and there was NO environment variable button nor any type of button!
 
Ok, give this a try:

In windows, open up your system properties window by going to "start" and right clicking on my computer and selecting "properties". You are now looking at general system information, right? From there, go the the advanced tab, where there should be performance, user profiles etc. At the very bottom, there is a button labeled "environment variables" - click it.

Once you are in the enviro window, edit the "Path" variable so that the first entry is something along the lines of C:\Program Files\Java\<java version>\bin;

Next, add a new variable called "CLASSPATH", and give it a value of "." (no quotes). Click ok to all the windows, reboot, and try compiling. Good luck - let me know if you have troubles.
 
Should that be adding the "C:\Program Files\Java\<java version>\bin;" variable at the start of the line or changing the first variable to it? It wants me to edit the value which is currently this "%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem" for "c:\Windows\System32; c:\Windows;..."
To what extent does java work with SP2? Is it true that SP2 has java already and that the compiler compiles things automatically on such machines?

In the command prompt I see the message "Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp"

This is when I try to compile a program which says "Hello World" and is entitled HelloWorldApp.java
 
Just add the "C:\Program Files\Java\<java version>\bin;" to the start of the variable, and leave the rest of the stuff after it.

Once that is in there, it should compile fine, assuming there are no errors in the code. If it starts to compile, but gives you an error, it means that something is wrong with your code, in which case you could try posting that here.
 
Back
Top Bottom