Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

PATH , CLASSPATH difference  RSS feed

 
vishvar hariraman
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody

Where the Javacompiler will find the supporting classes?
PATH or CLASSPATH environment variable?
pls clarify

Thx in advance
Vishnuvardhan.H
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java does not use PATH for any purpose. The operating system uses it to find programs; the OS will use PATH to find java.exe, for example.

Java will use a CLASSPATH environment variable to find class and jar files but it's generally a bad practice to use it. If necessary, you can use the "-cp" switch to javac.exe or java.exe to specify where these programs should look for classes; this makes it much easier for each program to look for classes in the place most appropriate for it. But note that with no CLASSPATH and no -cp switch, these programs will both look in the current directory for classes, which, when you're just starting out, is almost certainly what you want.

I'm moving this to the "Java in General (Beginner)" forum, where it's on topic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!