Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i know the JVM is already installed on my computer ?

 
Hiep Nguyen
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello !
how can i know the JVM is already installed on my computer ?
thank you !
 
Gaurav Mac Mathur
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which OS ?
for Windows you can find out in Add Remove Program, or by simpally typing java or javac on Command window.
for MAC check for Library/Java/Home/ **** folder.
cheers
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can search for a file named javac.exe
 
Hiep Nguyen
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks you for your advices!!!
last time i don't tell detaily my request. i use Window OS, now i want to know how an Application can know that my computer is installed JVM or not?
thank you !!!
 
bharat nagpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can javac.exe ensure that JVM is installed on the machine?
 
Neelima Paramsetty
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if u type javac at command promt it must display the javac options,then only we confirm that JVM is installed
 
Gaurav Mac Mathur
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me rephrase the Original Question by HN.
what he intend to ask is how a Application he is developing "Possibally in Java" Get access to the local sytem and determine if JVM is good and working on the machine.
I dont have any Solid Answer for this, but you can access teh CLASSPATH using teh System class and see if JDK_HOME is set there. ( _This is not the best/fool proof way_ )
Cheers
 
bharat nagpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac is java compiler. I don't think checking the javac will ensure this.
and It's not that JAVA_HOME is always there.
As far as I know in windows you can check this entry in registry.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This seems like a "chicken before the egg" question since the JVM must be installed before your Java application can run. In order to to ensure that the JVM is installed before a user runs the application you wrote you should use an installation tool. These kinds of tools can make sure the correct components are installed for your application. I see many Java-based programs that use Install Anywhere. There are probably others as well, but I am not familiar with them.
If a JVM is already installed, these tools can also detect if it is the correct version. Alternatively, there is probably a way to check the version once your program is running. As stated earlier, this still requires some version of the JVM to be installed already.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic