• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

classpath error

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 9691
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9691
42
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 814
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Shiva,
For classpath setting click here
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic