| Author |
classpath error
|
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
I have downloaded JDK 1.5 and setted the environment variable as
.;C:\ProgramFiles\Java\jdk1.5.0_20\bin;
and I have created my first java program and put it in directory PP that direstory is created inside C:\ProgramFiles\Java\jdk1.5.0_20\bin.
now, in that commad prompt, i have given
set CLASSPATH
that gave result CLASSPATH=.;C:\ProgramFiles\Java\jdk1.5.0_20\bin;
now, I am at pp folder>javac JavaHelloWorld.java
it gives javac is not recognized......please help me
|
 |
Lucas Smith
Ranch Hand
Joined: Apr 20, 2009
Posts: 804
|
|
You have to modify System Variable - PATH - and put there link to the javac.
If you do not have PATH variable - create one.
|
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
This is not a ClassPath problem. Set the path environment variable to include
C:\ProgramFiles\Java\jdk1.5.0_20\bin
The classpath variable doesn't need to include this path...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
Thanks for the help, Lukas and Ankit.
After set
PATH=.;C:\Program Files\Java\jdk1.5.0_20\bin
i am getting the same error
C:\Program Files\Java\jdk1.5.0_20\bin\PP> javac
'javac' is not recognized as an internal or external command,
operable program or batch file.
|
 |
Lucas Smith
Ranch Hand
Joined: Apr 20, 2009
Posts: 804
|
|
You have to create PATH variable in the same place where CLASSPATH variable is defined.
After that you have to reopen your console - it takes PATH value when it starts.
|
 |
krishna kanthgaru
Greenhorn
Joined: Feb 12, 2007
Posts: 17
|
|
as lukas said , we need to create "PATH" variable in "system variables" section.
also , put ";" towards the end.
|
no signature ... i am not a celebrity yet
|
 |
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
Thanks for the reply. I actually changed the CLASSPATH to PATH and already ; was at the end.
please note the my first java application is on pp directory and i have placed this directory in
c:\program files\jdk....\bin path
still,the error comes
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
I think you might have created two path environment variables. Try this on the console
set PATH=%PATH%;C:\Program Files\Java\jdk1.5.0_20\bin
Then try to run the javac command in the same console. Also I hope that your JDK is installed in the directory that you gave us i.e. C:\Program Files\Java\jdk1.5.0_20\ and there is a javac.exe in the directory C:\Program Files\Java\jdk1.5.0_20\bin...
|
 |
Ninad Kulkarni
Ranch Hand
Joined: Aug 31, 2007
Posts: 774
|
|
Hi Shiva,
For classpath setting click here
|
SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12921
|
|
The problem could be that there is a space in C:\Program Files\...
Surround it with quotes, like this:
set PATH=%PATH%;"C:\Program Files\Java\jdk1.5.0_20\bin"
Note that PATH and CLASSPATH are two different things!
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: classpath error
|
|
|