Forums Register Login

JAVA_HOME/bin and lib - fundamental questions

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
    +Pie Number of slices to send: Send
    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.
    +Pie Number of slices to send: Send
    Thanks a lot guys....that was really helpful and cleared my doubts and misconceptions.

    regards,
    Devashish.
    +Pie Number of slices to send: Send
    You're welcome
    permaculture is largely about replacing oil with people. And one tiny ad:
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 650 times.
    Similar Threads
    deploytool
    about tomcat
    JAVA_HOME should point to a JDK not a JRE
    Need help : urgent
    no weblogicoci37 in java.library.path
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Apr 15, 2024 22:21:19.