aspose file tools*
The moose likes Java in General and the fly likes JVM for jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM for jar" Watch "JVM for jar" New topic
Author

JVM for jar

Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
How do I find which JVM is being used for a jar file?

Please help.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Define "which JVM." JVM version, or path to the executable? If it's the former, just check the "java.version" system property. If it's the latter, you may be able to use Class.getResource() to get a file:// URL for a System class file, then examine the URL for a local path.


[Jess in Action][AskingGoodQuestions]
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
The system I am wokring on may be having multiple versions of JVM. SO I guess to find version I will have to go second route you pointed.
This might be bigginer question, Can you eloborate how do I use Class.getResource?
I have .jar files in a directory and I want to find which JVM each one is using.

Thanks for your reponse
Gemini
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

Originally posted by Gemini Moses:

I have .jar files in a directory and I want to find which JVM each one is using.


Nothing about a jar file itself will tell your computer what JVM to use; it depends only and entirely on your computer's settings. If we're talking about a jar file you double-click to execute, then you need to look at the OS's file association for jar files, and possibly (if the association doesn't specify a path) your PATH environment variable to see which version of "java" is first on the path.

Is that all you're asking?
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Got you. Thanks!
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

java -version
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JVM for jar
 
Similar Threads
Using the Application database connection from an application
WA #2 ..... word association
Regarding Jar File
Suddenly getting java.lang.NoClassDefFoundError
jar file convertion from 32 bit to 64 bit