Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Path and classpath required

 
sweety mehra
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
to run java program, what complete path and classpath to be set as an enivronment variable.
Also tell me ,what value should be set for JAVA_home and why JAVA_HOME is needed
 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 240
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JAVA_HOME must point to your java install directory and you should also include %JAVA_HOME%/bin in your path (Because you have the executables in the bin directory).Classpath refers to dependencies,that will depend on the application.

Regards,
Srikkanth.M
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15205
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not need to set any environment variables to be able to run Java programs.

You can add the bin directory of the Java Runtime Environment (JRE) or Java Development Kit (JDK) to the PATH if you want - this is only for convenience, so that you don't have to type the whole path every time.

You do not need to set CLASSPATH. If you need the JRE to look for classes in other places than the directory from where you start your program, then you can set the classpath on the command line with the "-cp" (or "-classpath") option.

The variable JAVA_HOME is not used at all by the JRE or JDK. Some programs use this to find your Java installation (Apache Tomcat for example), but Java itself does not need it.
 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 240
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper,

That was very helpful.It weeded out certain misconceptions.

Thanks,
Srikkanth.M
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic