Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Command "java" works, but "javac" does not

 
Alex Pol
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have installed the J2SE SDK 1.5, the environment variable (user variable) JAVA_HOME is well set to C:\Program Files\Java\jdk1.5.0_08 but the command "javac" does not work. It works only if i am in the bin sub directory of the directory above.

Why is that? The command "java" works !

Thanks.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps your path variable is pointing to JRE instead ? Can you post the contents of your 'path' system variable ?
 
Vyas
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
true your path variable is pointing to JRE. Or reinstall JSDK
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15482
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Re-installing the JDK will not help.

Make sure that the 'bin' directory of the JDK is in the PATH. The JDK installation instructions explain how to do this (see step 4).

Since you have the JDK in C:\Program Files\Java\jdk1.5.0_08, you have to add C:\Program Files\Java\jdk1.5.0_08\bin to the PATH.
[ June 10, 2007: Message edited by: Jesper Young ]
 
saidi Bandi
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex Pol


you have to setclass path="set to bin folder in java";
as wel as JAVA_HOME="to java folder"..
 
Alex Pol
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"you have to add C:\Program Files\Java\jdk1.5.0_08\bin to the PATH."

To which "PATH"? JAVA_HOME?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15482
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, to the environment variable named 'PATH'. See step 4 of the JDK installation instructions; the link is in my answer above.
[ June 11, 2007: Message edited by: Jesper Young ]
 
nitin goswami
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add:

Various Environment Variables:
------------------------------
PATH: Path of the Folder/Directory which contains the executable(.exe) files should present in PATH. Generally every application keeps there .exe files in BIN directory.(e.x. JDK, Tomcat, JBoss ...etc) thus for example: for J2SDK installed in the following location then C:\j2sdk1.4.1_03\bin should be there in PATH variable.

CLASSPATH: This environment variable keeps track of all the class files which we want to make available for "Compiler Search". If you want your class to be found by javac tool, mention the location of the file(s) in CLASSPATH variable or put that file in the directory from where you are running javac command.

JAVA_HOME: Is the way to tell a Tool (ex. Tomcat ) that my JDK is installed in the specified location. Actually These tools use JAVA_HOME environment variable as the part of the implementation of various functionality knowing the fact that user can install the JDK at any location so providing a user flexibility and to generalize their functionality implementation JAVA_HOME comes into picture.

Any suggestions or comments will be appreciated.

Thanks
-Nitin
 
Mahi Rahman
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\Program Files\Java\jdk1.5.0_08\bin

and it should work now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic