• 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

How to use the JRE I want, to launch my program when I have two JDKS installed?

 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have JDK 6 and JDK 5 installed.I can use the preferred compiler by setting the path at the time of compiling But How do I use the preferred JRE to run a program using the "java" command?

 
Varuna Seneviratna
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Matter resolved, By setting the path it is possible to invoke the preferred JRE and the Compiler both.But if the path is not set at the time of compiling, the JRE that is invoked by typing "java" at the command prompt is the JRE that was installed with the first JDK installed.
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But if the path is not set at the time of compiling, the JRE that is invoked by typing "java" at the command prompt is the JRE that was installed with the first JDK installed


How do you define the "first JDK installation" here? In general it's the first to appear in the path is picked. And you can check the version used by java by typing java -version. For this, of course you should have set the path appropriately or be in the JDK/bin directory or use the exact path to the JDK/bin.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe better to write the full path when you invoke "java" . . . or similar. Saves problems later when you have forgotten what you changed the system PATH to. You may need "" if there is a space in the PATH
 
How do they get the deer to cross at the signs? Or to read 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