Forum Stats

  • 3,852,612 Users
  • 2,264,123 Discussions
  • 7,905,104 Comments

Discussions

Which JVM am I using?

843807
843807 Member Posts: 46,582
edited Feb 13, 2003 3:41PM in Java Desktop Applications
Hi all,
I'm working on testing some java code inside the browser. I've been using the MS JVM for a while, and I wanted test compatibility with the SUN JVM. I installed the 1.4.x J2RE and java plugin, and I expected the SUN magic to happen the next time I ran my app. No luck - when I bring up IE and login to my app server, it looks like it's all going through the MS VM.

Then I notice the IE option "Use Java 2 v1.4.1_01 for <applet>" as an option. It's checked on. Even when I bring up applets, there's no SUN love. My evidence is the fact that View|Java Console will show the MS console and the thread list refers to all of the stuff that I'm looking at.

The thing is, we're not using applets (as far as I know). All of the java code I'm working on are .class files I'm pulling into the browser in signed cabs, being invoked directly from client side HTML. No <applet> tags here.

So, my question - how do I ditch the MS JVM? For applets and for direct java calls?

Comments

  • 843807
    843807 Member Posts: 46,582
    The thing is, we're not using applets (as far as I know). All of the
    java code I'm working on are .class files I'm pulling into the browser
    in signed cabs, being invoked directly from client side HTML. No
    <applet> tags here.
    Do you notice anything wrong with what you're saying? First, a signed CAB file. Java (real Java) doesn't know what a CAB is. It can handle a signed JAR file, but not a yellow taxi. And what does "being invoked from the client side HTML" mean? Java either works as an Applet using the Applet or Object tag. If neither of those are used, it doesn't run in the browser. (i.e. It's an Application) Of course, if you're performing Windows voodoo to launch it from the browser as something other than an Applet, then you're in unsupportable territory.
  • 843807
    843807 Member Posts: 46,582
    Hi bick_at_work,

    in order to make your browser load the Java Plugin instead of the Microsoft JVM, you have to change the HTML page which loads your applet. Perform a serach on Sun's website regarding the topic HTMLConverter or have a look at http://java.sun.com/products/plugin/1.3/docs/htmlconv_01.html.

    You feed the HTMLConverter with the original HTML file that brings up the applet. Out comes an upgraded version of your HTML page which has some JavaScript code in it, in order to load the Java VM Plugin you need!

    I hope this helps!
    Mikno
  • 843807
    843807 Member Posts: 46,582
    Thanks for the responses...
    Do you notice anything wrong with what you're saying?
    First, a signed CAB file. Java (real Java) doesn't
    know what a CAB is.
    I believe in this case, CAB is the download and archive mechanism of IE, and java shouldn't even see this level. I'll provide an example in a moment...

    It can handle a signed JAR file,
    but not a yellow taxi. And what does "being invoked
    from the client side HTML" mean? Java either works as
    an Applet using the Applet or Object tag. If neither
    of those are used, it doesn't run in the browser.
    You are correct. I was looking for <applet> tags, but not <object> tags. The code I'm looking is invoking the java classes via Object tags.

    So here is my example (from an offending html file):

    <object
    code="com.mystuff.MyFunctioningJava.class"
    id="MyClassFactory"
    name="MyClassFactory"
    viewastext>
    <param name="useslibrary" value="MyLibrary">
    <param name="useslibrarycodebase" value="Download/MyLibraryInAYellowTaxi.cab">
    <param name="useslibraryversion" value="1,1,0,10">
    </object>

    I believe this will extract the necessary class file(s) from the cab, and then load it in the JVM. In this case, the MS JVM no matter what I try. That continues to be my problem...
  • 843807
    843807 Member Posts: 46,582
    Plain and simple, if you use CAB files, it won't work in true blue (purple?) Java. CAB files are a Microsoft concept and will result in the Microsoft VM being invocated. If you want to use a more standard VM, you either have to use a ZIP or a JAR file. (The difference being that JAR files can be signed.)

    Just so you are aware, the plugin is responsible for dealing with whatever file is passed. IE may be capable of understanding CABs, but it's up to the VM to actually do something with it.
  • 843807
    843807 Member Posts: 46,582
    Plain and simple, if you use CAB files, it won't work
    in true blue (purple?) Java. CAB files are a Microsoft
    concept and will result in the Microsoft VM being
    invocated. If you want to use a more standard VM, you
    either have to use a ZIP or a JAR file. (The
    difference being that JAR files can be signed.)

    Just so you are aware, the plugin is responsible for
    dealing with whatever file is passed. IE may be
    capable of understanding CABs, but it's up to the VM
    to actually do something with it.
    Thank you, this makes sense (curse you, MS!)

    So if I switch to a JAR or ZIP file, will I automagically use the SUN java plugin? Or are any games I have to play in the Object tag to specifically load the SUN JVM? Like with the Applet tag conversion util that SUN offers?
  • 843807
    843807 Member Posts: 46,582
    I don't know if just changing the code to use a JAR will work or not. The Java Plug-in supports the Object tag, but Sun's done a 180 and dropped the Object tag in favor of the Applet tag (again!). Poke around a bit and you should be able to find the Object syntax if that's what you really want. Using the Applet tag is probably the best way to go however.

    Here's Sun's latest info on this:

    http://java.sun.com/docs/books/tutorial/uiswing/components/applet.html
This discussion has been closed.