Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Fern Sanchez   on Oct 01 In Java Category.

  
Question Answered By: Dang Tran   on Oct 01

No! command  prompt (cmd) does not know what “javac” is until you create a variable named “path”. Following, I tell you how you can set up this variable.
If you set up the “PATH” variable, you can access to “javac” and other files in everywhere in your computer regardless of where you are.

In order to set up this variable, under windows XP, you should do these:
1. Start/Control Panel/System/Advanced tab/
2. Click on “Environment Variable”
3. In “Environment variable” window, there are two locations: “User variables” and “System Variables”. In “System Variables” find a variable named “PATH” (If you can not find this variable, click on “new”, otherwise click on “edit”)
4. If you click on “new” enter “Variable name” as “Path” and enter “Variable value” as you JDK or SDL installation directory. For example, if you install  JDK in “D:\Java\jdk1.5.0_06\” you should type “D:\Java\jdk1.5.0_06\bin” (because javac  is in bin directory)
5. If you click on “edit”, after all the “Variable value” content, type “;” and then “D:\Java\jdk1.5.0_06\bin” (This is where I install JDK). For example like this: “some other things; D:\Java\jdk1.5.0_06\bin”.
6. Click on all “ok”s.
Now, open a command window (start/run/cmd) in order to check whether you do the above lines correctly. Enter for example “java –version” or “javac help”. If you see an error message, you are doing something wrong, otherwise everything is ok.

Now, you can navigate to your project folder. For example if you have a “test.java” file  in your desktop, navigate to your desktop  in cmd and then enter javac test.java, and then java test

Share: