5/21/2006

JAVA_HOME vs java.home

What's the difference between JAVA_HOME and java.home? JAVA_HOME is the JDK install directory, e.g., C:\jdk5. It's meant to be set as an environment variable and referenced in Windows batch files or Unix scripts. I always have it in my Windows Control Panel and .tcsh files,along with other common environment variables. Some Java applications use the name jdk.home for this purpose, which I think is a better name. But JAVA_HOME has been used since the beginning and is now a convention.

java.home is the JRE install directory, e.g., C:\jdk5\jre, or C:\Program Files\Java\jre1.5.0_06. Unlike JAVA_HOME, I never seen java.home as an environment variable. java.home is a build-in Java system property, whose value is the JRE install directory. Since all Java system properties are also exposed as Ant build properties, you can also use ${java.home} in build files.

Would jre.home be a better name? Maybe, but I don't think Sun will change it.

Therefore, java.home is always there inside JVM, whereas JAVA_HOME exists mainly in your shell environment and you may pass it to JVM as a system property. Why do we still need JAVA_HOME? Well, there are good reasons:

  • You can add $JAVA_HOME/bin to the beginning of your PATH, to make sure you always invoke the right java program. On Windows, java.exe is duplicated in several places, for instance %JAVA_HOME%\bin\java.exe, $JAVA_HOME\jre\bin\java.exe, and %SystemRoot%\system32\java.exe. Without have $JAVA_HOME/bin at the beginning of the PATH, a java command will always resolve to %SystemRoot%\system32\java.exe, which may not be what you want. The same problem can also exist in Linux/Solaris.

  • Some Java application runtime needs to use tools/libraries only available in JDK. For example, web containers need tools.jar in JDK to compile JSP pages, and ejb containers also need to invoke javac/rmic tools in JDK. So the build-in system property java.home is not sufficient.

    81 comments:

    lanada333 said...

    Hi every one
    That's information is clear and interesting but were I can put the JAVA_HOME path in a (WINDOWS7 or VISTA) to reconice the NetBeans are installed in my system
    Tankyou for all and perdon by my English.

    Anonymous said...

    @lanada333

    Vista: Start -> right click on computer -> Properties -> Advanced System Settings -> Environment Variables -> New.. (in 'User Variables') and you add your new variable.

    VirtualVAT said...

    JAVA_HOME is system environment variable and java.home is JVM property. Either one or another can be used to specify java home directory for the virtual machine.

    jane rechod said...

    I'm new to this - but I need to get my head round it for a work project. So, is the java.home property universal throughout the JVM or just local to where it's declared?

    javahowto said...

    You can say it's universal across teh JVM. That is, after starting the JVM, java.home system property is there until JVM shutdown.

    Sandeep Kumar said...

    Nice tutorial. You can also refer this link to to set environment variables PATH, CLASSPATH and JAVA_HOME for compiling and running of Java applications. http://www.a2ztechguide.com/2011/10/setting-environment-variables-javahome.html

    OdishaHaal said...

    This is very informative post. Thank you so much for sharing..
    Real Estate in India

    Anna said...

    Great and Useful Article.

    Online Java Course

    Java Online Training

    Java Course Online

    J2EE training

    online J2EE training

    Best Recommended books for Spring framework

    Java Interview Questions












    Java Training Institutes in Chennai

    Java Training in Chennai

    J2EE Training in Chennai

    java j2ee training institutes in chennai

    lisa steve said...

    I’m eager to find the valuable information and for me this is the right place to get the good stuff. http://handytoolshome.com/

    Java Training in Bangalore said...

    This is the right site for everyone who would like to find out about this topic.
    Java/J2ee Classes Bangalore
    Java Training Center Bangalore
    Java Training in Bangalore
    Best Core Java Training in Bangalore
    java Courses in Bangalore
    Best Java Training Institute Bangalore Marathahalli
    Core and Advanced Java Institute in Marathahalli
    Java Training Institute in Bangalore Marathahalli
    Advanced java Training in Bangalore
    Advanced java Training in Bangalore

    sureshbabus said...

    Nice info!
    suresh babu

    sureshbabus said...

    This is the right site for everyone who would like to find out about this topic. You realize so much its almost tough to argue with you (not that I actually would want to…HaHa). You definitely put a fresh spin on a topic which has been discussed for ages. Wonderful stuff, just great!
    Angular 2 Training in bangalore , Angular 4 Training in bangalore , Angular 5 Training in bangalore , Angular 6 Training in bangalore , Angular 7 Training in bangalore , Angular 2 Institute in bangalore , Angular 4 Courses in bangalore , Angularjs Classes , Angularjs Training in Bangalore , Angularjs Training Institute Bangalore , AngularJS Classes in Bangalore , Python Training in Bangalore

    Anonymous said...


    I like looking through a post that will make people think. Also, thank you for allowing me to comment!

    UI Development Training In Marathahalli

    Web Designing Training In Bangalore

    Web Designing training institutes Marathahalli bangalore

    Web Designing Course Bangalore



    best Web Designing training center in Marathahalli Bangalore







    Infocampus said...

    A great blog with informative post.

    selenium training in Bangalore
    web development training in Bangalore
    selenium training in Marathahalli
    selenium training institute in Bangalore
    best web development training in Bangalore
    selenium training in marathahalli

    Infocampus said...

    selenium training in marathahalli

    Pugazhendhi said...

    This is so interesting! Android training in Bangalore i don't believe I've really read through anything like that before. therefore fantastic to get another person Android training in Bangalore with a few unique thoughts on this issue. Seriously.. many thanks for starting this up. This website is something that's required on the web, somebody with a small amount of originality!

    Anonymous said...

    Indonesia
    Easy
    Learning
    Indonesian
    Jual Beli HP
    bimbelbateraiLampung
    Service HPlampungservice.com

    Digital Marketing Institute in Delhi said...

    BECOME A DIGITAL MARKETING
    EXPERT WITH US. Call Us For More Info. +91-9717 419 413, 8057555775
    COIM offers professional Digital Marketing Course Training in Delhi to help you for jobs and your business on the path to success.
    Digital Marketing Institute in Greater Noida
    Digital Marketing Course in Laxmi Nagar
    Digital Marketing Institute in Delhi
    Digital Marketing training in Preet Vihar
    Online Digital Marketing Course in India
    Digital Marketing Institute in Delhi
    Digital Marketing Institute in Delhi
    Digital Marketing Institute in Alpha

    ritu said...

    Thanks for sharing such helpful information with all of us I appreciate your effort of writing a value able piece of content.
    http://www.rankingsstar.com

    Digital Marketing Service said...

    Hi,

    Thanks for sharing information. I have read all details i really tell you good content and also good website.

    Best honeymoon place in himachal
    Best places to visit in delhi
    best honeymoon place in kerala
    best tourist place in goa
    best tourist places in jharkhand
    places to visit in uttar pradesh
    honeymoon destinations in india
    five star hotels in delhi
    most romantic honeymoon destinations in india


    Thanks

    Top 10 Iconic Places to Visit in Delhi said...

    Thanks for given information about above Article all the details
    are very useful.

    Institute Coim said...

    thanks for information.
    Home Salon

    Vaishviktrends.com said...

    If you are looking for Best Gyms in Ghaziabad then click on the given link.

    Digital Marketing Service said...

    Best Adventure place in Himachal

    Best honeymoon place in himachal
    Best tourist place in delhi
    best honeymoon place in kerala
    best tourist place in goa
    best tourist places in jharkhand
    places to visit in uttar pradesh
    honeymoon destinations in india
    most romantic honeymoon destinations in india
    five star hotels in delhi
    five star hotels in delhi list
    list of all 5 star hotels in delhi
    5 star hotels in delhi near airport
    hotel in delhi
    hotels in delhi near railway station

    Top 10 Iconic Places to Visit in Delhi said...

    Thanks for given information about above Article all the details
    are very useful.

    Digital Marketing Service said...



    Hi,

    Thanks for sharing very useful information and i request to you please keep sharing ahead.

    Thanks

    Top 10 Iconic Places to Visit in Delhi said...

    Thanks for given information about above Article all the details
    are very useful.

    deepika said...

    Very Informative information .
    spring mvc interview questions

    BluePrint Global said...

    Booth Contractor Cologne

    Top 10 Iconic Places to Visit in Delhi said...

    Thanks for given information about above Article all the details
    are very useful.

    unknow said...


    I really enjoyed your blog Thanks for sharing such an informative post.
    https://myseokhazana.com/
    https://seosagar.in/
    Indian Bookmarking list
    Indian Bookmarking list
    India Classified Submission List
    Indian Classified List
    Indian Bookmarking list
    Indian Bookmarking list
    India Classified Submission List
    Indian Classified List

    unknow said...

    I really enjoyed your blog Thanks for sharing such an informative post.
    https://www.friendshipclubonline.com
    Friendship Club In India
    Friendship Club In Mumbai
    Friendship Club In Delhi
    Friendship Club
    Friendship Chandigarh

    Unknown said...

    Nice Post thanks for the information, good information & very helpful for others,Thanks for Fantasctic blog and its to much informatic which i never think ..Keep writing and grwoing your self

    duplicate rc in delhi online
    duplicate rc in ghaziabad
    duplicate rc in online
    duplicate rc in greater noida
    duplicate rc in mumbai
    duplicate rc in bangalore
    duplicate rc in faridabad
    duplicate rc in gurgaon
    duplicate rc in noida
    death certificate online

    Unknown said...


    슬롯게임
    해외토토사이트

    슬롯사이트-크레이지슬롯

    온라인슬롯머신

    카지노사이트

    크레이지슬롯

    슬롯게임
    슬롯게임
    하이게이밍 하이게이밍

    크레이지슬롯

    파워볼사이트

    Angular expert said...

    pretty! This was a really wonderful post. Thank you for providing these details


    UI Development Training in Marathahalli

    Full stack Development Training in Marthahalli Bangalore


    UI Development Training in Bangalore


    Angular Training in Bangalore

    Python Training in Marathahalli, Bangalore

    Selenium Training in Marathahalli, Bangalore


    Reactjs Training in Marathahalli, Bangalore

    Anandita said...

    Way cool! Some extremely valid points! I appreciate you penning this post plus the rest of the site is very good.
    UI Development Training in Bangalore
    Web Designing Course Bangalore
    UI/UX Design Courses in Bangalore

    Angular expert said...

    Pretty! This was a really wonderful post. Thank you for providing these details.


    Angular Training in Bangalore

    Python Training in Marathahalli, Bangalore

    Selenium Training in Marathahalli, Bangalore


    Reactjs Training in Marathahalli, Bangalore

    Angular expert said...

    UI Development Training in Marathahalli

    Full stack Development Training in Marthahalli Bangalore


    UI Development Training in Bangalore

    Vani said...

    I like looking through a post that will make people think. Also, thank you for allowing me to comment!
    PHP Training in Bangalore

    abhijeet aswal said...

    thanks for the java onformation

    Unknown said...


    바카라사이트
    바카라사이트
    카지노사이트
    바카라사이트
    릴게임사이트
    슬롯사이트
    바다이야기
    스포츠토토

    Unknown said...

    it is very interesting for a website with this kind of quality
    Google ads tips
    Thanks for provide great informatic and looking beautiful blog
    하이게이밍
    크레이지슬롯
    슬롯게임
    경마사이트
    하나라이브
    해시게임
    그래프게임
    온라인슬롯머신
    스포츠토토사이트

    바카라사이트 said...


    바카라사이트
    크레이지슬롯

    파워볼사이트

    akshay said...

    I really enjoyed your blog Thanks for sharing such an informative post
    also visit my website for songs
    Thodi Jagah From Marjaavaan Song

    GNIM said...

    The blog was very helpful for me as it helped me sorting out various issues. This was totally awesome and resourceful.
    Am Happy to find such good and valuable information.

    Best PGDM institute in Delhi NCR | Best MCA BCOM colleges in Delhi NCR.
    GNIM is the Best PGDM institute in Delhi NCR | Best MCA BCOM colleges in Delhi NCR. Guru Nanak Institute of Management is best institute in punjabi bagh.
    best pgdm institute in punjabi bagh
    best pgdm institute in delhi NCR
    top pgdm institute in delhi
    best mca bcom college in delhi NCR
    best pgdm colleges in delhi
    top pgdm mca bcom college in delhi
    top bcom colleges in delhi
    best pgdm institute in punjabi bagh
    best MCA institute in punjabi bagh
    best pgdm institute in west delhi
    best MCA institute in west delhi
    best bcom college in west delhi
    top bcom colleges in west delhi
    top bcom colleges in punjabi bagh
    best bcom institute in Punjabi bagh
    gnim
    gnim.ac.in

    Home Salon said...

    Amazing write up, never read such an informative blog and enjoyed it. Thankyou. Keep up the good work. Looking forward to read more.

    Home Salon Dubai
    Salon at Home Dubai
    Beauty Services at home Dubai

    neha said...

    I have to agree with all your inclusions such great information that will be very useful, Thank you for sharing this great blog.
    Events Planner In Delhi
    Wedding Planner In Delhi

    meritstep Technology said...

    Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    best angular js online training

    Radhika said...

    Thanks for sharing this fantastic blog, really very informative. Your writing skill is very good, you must keep writing this type of blogs

    Home Salon Dubai
    wedding car hire gurgaon
    wedding car hire banglore wedding car hire delhi
    wedding car hire dehradun
    wedding car hire noida

    meritstep Technology said...

    Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website
    top microservices online training

    Vipin Chauhan said...

    Nice Post thanks for the information, good information & very helpful for others,Thanks for Fantasctic blog and its to much informatic which i never think ..Keep writing and grwoing your self

    rc transfer in delhi
    rc transfer in ghaziabad
    rc transfer in noida
    rc transfer in gurgaon
    rc transfer in faridabad
    rc transfer in bangalore
    rc transfer in greater noida
    rc transfer in mumbai
    rc transfer in ranchi
    rc transfer in chennai

    Granth said...

    baari bilal saeed song download
    baari bilal saeed song download

    baahon mein the doorbeen mp3 song
    baahon mein the doorbeen mp3 song
    gajban pani ne chali mp3 song sapna choudhary
    gajban pani ne chali mp3 song sapna choudhary

    Granth said...

    VRN is one of the leading Offshore IT outsourcing companies in India offering Custom Software development services. Hire Virtual Employee List of best Punjabi songs (List of latest Punjabi songs), List of best Punjabi songs: Hello friends, best punjabi songs 2019, download punjabi songs, punjabi songs mp3, latest hit punjabi songs, listen punjabi songs list of Punjabi songs List of Bollywood comedy Films

    Unknown said...

    Nice blog.Thanks for sharing this information.
    If you want to know about latest fashion then please visit my site:-

    thefashionlifestyle

    lajwantidevi said...

    vidmate

    Unknown said...

    Nice blog.Thanks for sharing this information.
    If you want to know about latest fashion then please visit my site:-

    thefashionlifestyle

    neha said...

    Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles.
    Events Planner In Delhi
    Wedding Planner In Delhi
    Download Yoast SEO Premium WordPress Plugin
    Download Yoast SEO Premium WordPress Plugin
    Digital Marketing Institute in Delhi
    Digital Marketing Course in Delhi

    Anurag gothwal said...

    Thanks for sharing this article.
    https://www.digitaldreamsjaipur.com/
    https://digitaldreams.com/
    http://wwaw.justlikenew.co.in/

    Anurag gothwal said...

    Thanks for sharing this article.
    Apple watches
    Apple watches series 1
    Apple watches series 3
    Apple watches series 4
    Apple watches series 5

    Rahul Aniket said...

    tamilgun movies

    devidson said...

    Have you really lost your Facebook account password? Don’t you know how to get it back without having to face any kind of problems ad hurdles regarding the same? Just be relaxed! You should approach the professionals who are proficient in providing the Facebook Customer Service and get the same.

    myeasyloanonline said...

    nice blogpersonal loan

    SAMANTHA said...

    Come quick and check this very awesome site! https://kyb7.com 온라인 슬롯머신 사이트

    lyricsgoody said...

    Download your favorite Latest Mp3 Lyrics which are available in English, Hindi, Bangla, Telugu, Latin, Arabic, Russian, etc.

    Click Here

    Click Here

    Click Here

    Click Here

    Click Here

    Reena said...

    Thanks for provide great informatic and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you once agian

    court marriage in delhi ncr
    court marriage in delhi
    court marriage in noida
    court marriage in ghaziabad
    court marriage in gurgaon
    court marriage in faridabad
    court marriage in greater noida
    name change online
    court marriage in chandigarh
    court marriage in bangalore

    Unknown said...

    Thanks for the sharing . very helpful information
    Check it mine

    We love Tattoos and we work to find and share the greatest Tattoos with You!

    https://tattoomagz.com/

    Abhijeet said...

    Thanks for the sharing . very helpful information
    Check it mine

    We love Tattoos and we work to find and share the greatest Tattoos with You!

    dolphin facts

    Yourdoorstep said...

    Thanks for provide great informatic and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you once agian

    name change procedure in india
    name change procedure in punjab
    name change procedure in rajasthan
    name change procedure in maharashtra
    name change procedure in andhra pradesh
    name change procedure in lucknow
    name change procedure in bihar
    name change procedure in chandigarh
    name change procedure in karnataka
    name change procedure in gujarat

    Ajay kumar said...

    Thanks for posting
    my website techwolk is related to technology

    카지노사이트 said...

    Online Baccarat site recommendation agency is 100% secure with Korea. You can now safely delight in the complete game of Baccarat at Hotel Casino devoid of going abroad. The security of on the web Baccarat websites is assured by the Korea Agency, the biggest agency in Korea. The objective of this website is always to help gamers find the very best baccarat web page to bet on.

    2020최고의 바카라사이트주소 인터넷카지노사이트바카라사이트 온라인카지노바카라사이트주소 카지노사이트 카지노사이트주소 바카라사이트 추천입니다 바로가 기주소 click
    바카라사이트
    카지노사이트
    생중계카지노사이트
    바카라사이트
    슬롯머신
    바카라사이트

    tiger shroff said...

    vidmate download
    vidmate apk

    Shivani said...

    Way cool! Some extremely valid points! I appreciate you writing this post plus the rest of the website is also really good.



    Best Advanced Java Training In Bangalore Marathahalli

    Advanced Java Courses In Bangalore Marathahalli

    Advanced Java Training Center In Bangalore

    Advanced Java Training Center In Bangalore

    Selenium Training in Bangalore

    Selenium Training in Marathahalli

    Selenium Courses in Bangalore

    best selenium training institute in Bangalore

    RIA Institute of Technology said...

    pretty! This was a really wonderful post. Thank you for providing these details...
    angular js training in bangalore

    RIA Institute of Technology said...

    Great post!! Thanks for sharing...
    Web Designing Course in Bangalore

    Home Salon said...

    Amazing write up, never read such an informative blog and enjoyed it. Thankyou. Keep up the good work. Looking forward to read more.

    Housely
    home decor
    best home interior design
    interior designer in dehradun
    interior designer in gurgaon

    akshay said...

    Great blog, Thanks to share this amazing information with us
    Please Visit my website Musicdhol for Download latest songs.
    Tujh Mein Rab Dikhta Hai – Unplugged

    Daksh Khattar said...

    Great post You are sharing much information keep it up ..awesome post




    I am sharing <biography of top-10-richest-actor-in-india Check my link for more information.

    Daksh Khattar said...

    Great post You are sharing much information keep it up ..awesome post


    I am sharing biography of top 10 businesses of india. Check my link for more informati
    on.

    Vipin Chauhan said...

    Thanks for provide great informatic and looking beautiful blog, really nice required information & the things i never imagined and i would request, wright more blog and blog post like that for us. Thanks you once agian

    religion change
    arya samaj mandir in ghaziabad
    arya samaj mandir in greater bangalore
    name change ads in newspaper
    arya samaj mandir in punjab
    arya samaj mandir in rajasthan
    arya samaj mandir in noida
    arya samaj mandir in gurgaon
    arya samaj mandir in faridabad
    arya samaj mandir in delhi

    Yogesh said...

    lyricswhispering

    Tech Line US Reader said...

    Thank you for sharing valuable ideas for the Secret to Getting rayiot monitoring