Link to home
Start Free TrialLog in
Avatar of jdargan
jdargan

asked on

Java applications not working with Sun JVM

Now that XP Service Pack 1A has been installed and we are using the Sun JVM with Internet Explorer instead of the Microsoft JVM, my Java applets not running. The way they used to work was that the menu page would invoke the HTML page that started the applet. Then the HTML page would revert back to the regular menu page, while the applet would continue to function until the user closed it down. Users would start and run several different Java applets in this manner. Now, when the HTML page reverts back to the regular menu page -- which is almost instantaneous -- the Java applet is killed. So, the user barely sees it and doesn't get to work with it. Does anyone know of a way to resolve this problem without leaving the child HTML page still open? I'd rather not have a solution that involves having several frames.
Avatar of sfotex
sfotex

Does the applet itself work with the sun jvm?
Or it works fine with the appletviewer and dies when
you start it the way you described in the browser?
Avatar of jdargan

ASKER

The applet works with the Sun JVM. It dies when the HTML page that started the applet navigates to another HTML page. This is not the way it worked under Microsoft's JVM. With Microsoft's JVM the applet continued to run until all instances of Internet Explorer were closed.
Avatar of Mick Barry
> It dies when the HTML page that started the applet
> navigates to another HTML page.

That is expected behavior, otherwise you would end up with your browser running every applet that it encountered in a session.

Sounds like you need to keep a thread running after your applet is shutdown.
What exactly is it that you are trying to achieve?

ASKER CERTIFIED SOLUTION
Avatar of warsql
warsql

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jdargan

ASKER

I'd rather not have a solution that involves having several frames, even if they are hidden. I'm not sure what the term "div" means.
What exactly is it that you are trying to achieve?

Avatar of jdargan

ASKER

I wanted my Java applet to continue working even if the user navigated to a different web page. The applets we have been using are invoked an HTML page, but they use the Java Frame class to apppear separately from the HTML page. With the Microsoft JVM they continue to appear even if someone navigates to another HTML page. With the Sun JVM they disappear the moment someone navigates from the original HTML page to a different page.
For the reasons I stated  above I believe Sun's VM behaviour is correct. That is non-default behaviour which you need to explicitly implement.
Avatar of jdargan

ASKER

Thanks, but I'm wondering what to do to implement this behavior without having to keep several hidden frames open for these applets.
As I mentioned in earlier comment try keeping a new thread running. You'll also probably need to maintain a static reference to things so newly loaded applets don't recreate things every time.
Avatar of jdargan

ASKER

I'm going to keep this open until Friday to see if I get any other answers. On Friday I'll award points based on whatever answers I've gotten. Thanks to everyone who've provided comments.
A div is an html tag.  You can put this anywhere in the body of your non-frame page. (Not that you couldn't use it within a frame).
<div style='visibility:hidden'>
<APPLET ...>
</APPLET>
</div>
Not much difference to using a 1x1 pixel applet.
If you're applet is on every page then you could just maintain a static reference to frame and make it visible whenever the applet loads.
Avatar of jdargan

ASKER

One of my co-workers suggested a solution that resolves the problem. Each time someone selects a button to start an applet, the button calls a JavaScript function that creates a separate frame using code like this:

<script language="JavaScript">

function SystemAdministration()
{
 var html = '<IFRAME SRC="main/sysadmin.html"><\/IFRAME>';
 document.body.insertAdjacentHTML('beforeEnd', html);
}
Not necessary, but if you're happy with it.