"JAVAC not recognised as an internal or external command"
I eventually found JAVAC.exe by browsing to this folder:
C:\Program Files\Java\jdk1.6.0_23\bin
There are two ways to avoid the error message:
1) Supply the full path to JAVA.exe when compiling
2) Add an environment variable to this path.
In windows vista this can be found in Control Panel\System\Advanced System Settings
There is a button here for Environment Variables, as shown in the screen shot:
In the system variables, look for one called path and edit it
In the variable value box go to the end, add a semi-colon and the path to the JAVAC folder, eg ; C:\Program Files\Java\jdk1.6.0_23\bin\
Once compiled and executing the class from the command prompt you may still get errors such as this:
Exception in thread "main" java.lang.NoClassDefFoundError: YourAppName(wrong
name: YourAppName)
- Two things to bear in mind, when using JAVA to execute the class, do not add the .Class suffix to the class name when executing.
- Everything is case sensitive. Make sure the name of the class you enter matches the actual name in case as well as spelling
No comments:
Post a Comment