• 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

JAVA_HOME/bin and lib - fundamental questions

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
     
    Marshal
    Posts: 79177
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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: 79177
    377
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    You're welcome
     
    The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic