• Post Reply Bookmark Topic Watch Topic
  • New Topic

JAVA_HOME/bin and lib - fundamental questions  RSS feed

 
Devashish Seth
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Guys,

I have just started on Java and was trying to know on the following:

1) What are the contents of the JAVA_HOME/lib directory? What would happen if this is not set correctly.
2) What is the purpose of setting the bin and the lib directories in PATH and CLASSPATH variables respectively.


Please help.

Thanks,
Devashish.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

The lib directory of your JDK or JRE contains libraries that Java itself needs.

It's simpler than you think:

  • Set the PATH so that includes the bin directory of your JDK. Your operating system uses the PATH environment variable to find executables (such as java.exe and javac.exe) to run. See the JDK installation instructions.
  • Do not set the CLASSPATH at all. It is not required. It is certainly not required (in fact, it would be wrong) to include the lib directory of the JDK in the CLASSPATH.
  • You do not need to set the JAVA_HOME environment variable. Java itself does not use it at all. Some third-party software (such as Apache Tomcat) requires it, however.


  • You do not need to do anything with the lib directory of the JDK.
     
    Campbell Ritchie
    Marshal
    Posts: 56536
    172
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You will find there are different ways to set the PATH, some with java home and some without. If you need java home, the instructions here have advantages.
     
    Devashish Seth
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks a lot guys....that was really helpful and cleared my doubts and misconceptions.

    regards,
    Devashish.
     
    Campbell Ritchie
    Marshal
    Posts: 56536
    172
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You're welcome
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!