I have installed java on windows-64bit OS. but when I execute javac, it is failing with the
error message no such command is available". I have created following environmental variable
CLASSPATH C:\Program Files (x86)\Java\jdk1.6.0_05\lib
Add the appropriate javac path to your PATH variable. java.exe
will be found under the bin
directory of your JDK. E.g.
SET PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.6.0_05\bin
Before answering your question, just wann ans this simple question : Why we need PATH and CLASSPATH?
Answer:
1) PATH: You need to set PATH to compile Java source code, create JAVA CLASS FILES and Operating System to load classes at runtime.
2) CLASSPATH: This is used by JVM and not by OS.
Answer to your question :
Just make sure you have Modified PATH variable (Windows System Environmental Variable) so that it points to bin dir which contains all exe for example: java,javac and etc. In my case it is like this : ;C:\Program Files\Java\jre7\bin.
So, it doesn't matter your system is 32 bit/64 bit until and unless you specify/Modify the PATH variable correctly.
Actually, the most conventional way of getting it done on Windows is
Path is one of the variables under "System Variables". This is where the system will search when you try to execute a command.
To verify, open the command window aka console window (for example, WindowsKey-R cmd.exe ) and run:
javac -version
If the java bin folder is in the path, the system will find and execute the javac.exe file located there, and you will see your Java version. Something like:
c:\>javac -version
javac 1.7.0_65
Very Simple:
You need to set the two environment variables only; PATH and java
=>Right Click on My computer
=>Properties
=>Click on left hand side bar menu "Advanced system settings" => Click on "Environment Variables" button refer below fig.
=>Follow the below steps to Set User variable and System variable.
To Set User variable named as "PATH"
To Set System variable named as "java"
For me, the 'JAVA_HOME' variable should be set as a System Variable, instead of User Variable. When the 'JAVA_HOME' was changed to be a System Variable, the command 'javac' works. Also, the PATH and CLASSPATH are System Variable.
javac
on the command line? I would use an IDE, its more productive/easier. If you really want to do this, there are loads of pages on how to do this on the web, I would search for one.javac
is IDE neutral. If you have a project which need Java 6 update 5 specifically, you have done something seriously wrong IMHO.