• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Java VM version query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java VM version query


  • Subject: Re: Java VM version query
  • From: Mike Hall <email@hidden>
  • Date: Fri, 01 Oct 2004 15:34:37 -0500

Richard Van Deren,

> How do you know which version of the Java VM an Cocoa application is
> using?

static String jVers = System.getProperty("java.version");

public static double getJavaVersion() {
if (jVers.length() < 4) return new Double(jVers).doubleValue();
if (jVers.indexOf("_") > -1) jVers = jVers.substring(0,jVers.indexOf("_"));
String vers = "0",decpart = "0";
if (jVers.length() >= 3)
vers = jVers.substring(0,3);
if (jVers.length() >=5)
decpart = jVers.substring(4,5);
return new Double(vers).doubleValue() + new Double(decpart).doubleValue() * .01;
}

is what I use. Someone may have more efficient, more general or in some way better.
The rest I can't directly check on right now but I can give vague and mysterious answers.

>My application seems to be using Java VM 1.3 when it should be using
> Java VM 1.4

There is a Info.plist setting where you can indicate the version you want to target. But I don't remember what it's called or the exact syntax. I think someone indicated it's pretty close to what WebStart uses for specifying the same.

> I am getting unsupported major minor version 48 errors when I load my
> classses.

A recent guess on something similar on javadev was that class files compiled against a later release were being attempted to run on a older release for this error.
The system property java.class.version=48.0
for java.runtime.version=1.4.1_06-b01
for me
seems like it'd be pertinent.

> The documentation and implementation of Cocoa using Java seems
> incomplete to me. Am I missing something?

I don't know about XCode (10.2 so not an option). There was some document with a fairly severe warning of some sort concerning Cocoa/Java but I don't remember the doc or the exact caveats. For the Cocoa I've messed with I use my own (Cocoa) Runtime concocted stuff.

Pretty vague exact on how to get version right now, sorry.

Mike Hall mikehall at spacestar dot net
http://www.spacestar.net/users/mikehall
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Java VM version query (From: Richard Van Deren <email@hidden>)

  • Prev by Date: Re: Help assistant
  • Next by Date: Re: Help assistant
  • Previous by thread: Java VM version query
  • Next by thread: Re: Java VM version query
  • Index(es):
    • Date
    • Thread