• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

seting the classpath

 
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

For some reason, after I'm installing my JRE, the class path is not set automatically.
When I type javaw on the prompt (c:\>javaw) I get the error message �not recognize as an internal or external command.


I tried in the environment variables � system variable �
And on the variable name: classpath
Variable value: C:\Program Files\Java\j2re1.4.2_09\bin;


This didn�t work.
Does anyone know how to set the classpath correctly?

 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter,
The classpath is used when compiling/running. The path itself is used to find the java/javac/javaw commands. So check the bin directory is in your path environment variable too.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error "not recognize as an internal or external command" means that Windows can't find javaw.exe, not that Java can't find classes (which is what CLASSPATH is for.) Windows uses a different environment variable named PATH to find programs. The JDK "bin" directory does not belong on the CLASSPATH, but it does belong on the PATH.

The very best setting for CLASSPATH for a new Java user is -- by a wide margin -- to not have it set to anything at all. The default is just perfect.
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"but it does belong on the PATH"

well, I can't compile and run anything because there is no access to the bin. how can i set it? I can compile it only from the bin, but I would like to compile it from a different folder.

thank you both for your quick reply
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to add the bin directory to the PATH variable. As noted above, this problem has nothing to do with the CLASSPATH variable. For instructions on how to do this, see step 5 in Sun's Installation Instructions.

Layne
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you need to set the path to the bin directory
Good luck
 
Peter Primrose
Ranch Hand
Posts: 755
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you all it works.
 
reply
    Bookmark Topic Watch Topic
  • New Topic