Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: javaws on command line



On Mar 13, 2006, at 2:56 PM, Steve Roy wrote:

On Monday, March 13, 2006, at 12:39PM, Michael J. Vinca <email@hidden> wrote:

I would tend to think the 1.4 version of javaws would launch stuff with the 1.4 JVM
and the 1.5 version would launch in the 1.5 JVM. I doubt the executable javaws knows
anything about the Java Preferences.app, but this is just my humble opinion.

I guess I'm just not clear on what the logic is supposed to be. As I see it, there are three variables that could impact on the version of the VM you get when running an app through Java Web Start:

1. The setting in Java Preferences.
2. The JNLP file.
3. The version of javaws.

Regarding 1), maybe this setting is just a way for the web browser to pick which javaws to use in launching the app? It's not obvious where the magic occurs here. Is it the web browser that launches a different app based on this setting? Or is it whatever is launched by the web browser that picks the right VM to run the app in?

Regarding 2), maybe the JNLP file can only check the current VM version and not actively pick it, as you suggest.

Regarding 3), I have the same question regarding the UI version of javaws (the app Java Web Start under /Applications/Utilities/Java). This app is set to run in 1.4* per the Info.plist file, so does that mean that whatever you run through this UI will get you a 1.4 VM?

You've asked a couple of good questions, so let me see what I can do to answer them. Let's start with a description of the process of how we handle a JNLP file.

-- Safari doesn't know anything about the details of JNLP files, other than the fact that they are considered safe for opening after download. LaunchServices knows that jnlp files are handled by Java Web Start.app (since its Info.plist claims that file type), so it launches the application and is sent an 'open document' event. Java Web Start then routes the file it was given through some native code given to us by Sun that does some basic parsing of the JNLP file. Web Start evaluates which version of Java will run the application, finds the 'safe' JVM parameters, 'safe' properties, and classpath for that version of Java, and then starts up the JVM, downloads the resources and runs your application.

-- When you install a release of Java 5, Java Cache Viewer.app also registers that it can open JNLP files, and since it is newer than Web Start, it becomes the default application owner for JNLP files. (This is a feature of LaunchServices.) It does the same things as Java Web Start.app, except that it is aware of the VM ordering shown by Java Preferences.app, and uses that to determine which VM will be used if the JNLP file specifies '+' for the version. Currently, 1.4+ gives you 1.4.2, unless you put 1.5.0 at the head of the list. In Java 5 Release 4, 1.4+ will give you 1.5.0, unless you change it back to 1.4.2 yourself. It also knows where to find the right JAR files for JNLP processing, so it can construct the classpath needed to launch the application specified in the JNLP file with either 1.4.2 or 1.5.0.

-- Out of the Tiger box, javaws is a symlink to /Applications/Utilities/Java/Java Web Start.app/Contents/MacOS/Java WebStart. When you installed a release of Java 5.0, the symlink is overwritten to point to /Applications/Utilities/Java/J2SE 5.0/Java Cache Viewer.app/Contents/MacOS/Java Cache Viewer. 

What all of this means is that 'javaws filename' is effectively the same as dragging the JNLP file on top of the JNLP opener (Java Web Start or Java Cache Viewer). The actual application used depends on whether or not you installed Java 5.

-- In a perfect world, we would have deleted Java Web Start.app when Java 5 gets installed, but due to a bad architecture decision, that would have rendered Web Start apps using 1.4 useless. Once you install Java 5, do your best to ignore the fact that Java Web Start.app is still there. (I plan to fix that in an upcoming release.)

-- In your first question, you asked about using javaws when passing an http URL -- 'javaws http://path/to/our.jnlp'. In this case, the native code that I mentioned earlier is not smart enough to download the file and determine the JVM that the JNLP descriptor wants. The Java portion of Java Web Start/Cache Viewer does that, so all the native code can do is use the default Java VM to start up Java Web Start, download the JNLP file, and then re-launch Java in the correct JVM.

So, to better answer that question, I'm going to assume that you have installed Java 5 at some point. What does the <resources> tag in the remote JNLP file say?

Maybe this is too much to ask for a Monday. Sorry. :)

That's okay. I enjoy talking about Java Web Start. :-) Let me know if you have any other questions.

Scott

------------------
Scott Kovatch
Apple Computer
Java Runtime Classes
Cleveland Hts, OH
email@hidden

I am Scott Kovatch, and I approved this message.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >javaws on command line (From: Steve Roy <email@hidden>)
 >Re: javaws on command line (From: Steve Roy <email@hidden>)
 >Re: javaws on command line (From: "Michael J. Vinca" <email@hidden>)
 >Re: javaws on command line (From: Steve Roy <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.