• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classpath error

 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to modify System Variable - PATH - and put there link to the javac.
If you do not have PATH variable - create one.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as lukas said , we need to create "PATH" variable in "system variables" section.

also , put ";" towards the end.
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 802
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shiva,
For classpath setting click here
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15354
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic