Applet + new window + loses session - Java Applet Development

I am doing the following on an applet that is embedded within a website that we have. The applet is visible on the application that we have. It used to be able to open the webpage and everything worked fine. Now for some unusal reason, the web page that it is trying to access and the window that opens loses the session. It essentials asks them to login again. Basically I want it to open a new window, and keep the session.
Below is the simple code that opens the new window:
getAppletContext().showDocument(new URL(mynewurlstr), "_blank");
Can anyone tell me what is wrong? 

What version of Java do you use?
In Java Control Panel->Advanced->Java Plug-in, do you have an "Enable next generation plug-in"?
If yes, disable it and retry.
If now it works, we know why it happens. Not that this is a good solution... 

That did it! What is causing this. Is there something more permanent that I can do either in the code or somewhere else that will not create the problem or is this an error in Java? 

dawuad wrote:
That did it! What is causing this.The Next Generation plug-in launches each applet in its own VM. Before all applets were running inside the same VM and, if downloaded from the same site, they were sharing the same class loader.
Meaning that they were sharing state, probably including session authentication information.
Is there something more permanent that I can do either in the code or somewhere else that will not create the problem or is this an error in Java?No idea. 

baftos, do you have a bug number? We are having the same problem and I would like to report a bug # to my boss.
Thanks, seanf 

805057 wrote:
... do you have a bug number? I do not believe Oracle would consider it a bug. OTOH this article ( on the new functionality suggests a forum you might report undesirable behavior.


How the applet gets downloaded to the brower end?

I am not able to find how the browser downloads an applet whole trying to execute it.
To make the scene more clear, I tried the below.
I tried to access an applciation which uses applet to do something at the client site (say it will enctypt my user name and send the ecncrypted string to the backend server.). When i am trying to access it, the status bar of my browser displays a message "Applet <ABCApplet> not initted" (I think it wants to say applet not initialized). To know if the applet is properly getting downloaded or not, I tried to use HTTPWatch(free version) to see if the browser is requesting for the applet or not, but found that the browser is neither requesting for the applet, nor it is requesting for the jar which contains the applet
I also tried to search the "temporary internet files" and the "temp" folder to search for the applet class and jar, but did not find anything.
So it will be of great help, if somone can help me to understand "HOW The browser downloads an applet and where it keeps it for using it" ?
Thanks in advance. 
Essentially you have some HTML markup (<applet..>, <object...>) that tells the browser to go get the applet, in the same way the <img...> markup tells the browser to go get an image.
I tried to use HTTPWatch...That is great, and if you are correct that the browser is not attempting to make the request for the applet, then it might be safe to assume your markup is bad. Is it possible to show the HTML markup (not the whole page, mind you, but just the <applet> or <object> tag)?
If you can, download the latest Firefox and then go get the HTTPFox add-on. It is just like HTTPWatch, but doesn't make you pay a thing to get full traces of everything in both directions.
In the future, also consider looking at the access logs on your server, as they should also show the reqeusts for resources such as applets.
Edited by: Java-Joe-Morgan on Feb 6, 2010 9:37 AM 
Deb, don't double post the same question. I'm removing the thread you started in the Java Runtime Environment (JRE) forum.
[_AndrewThompson64_|]'s response on that thread is reproduced here for your convenience.
AndrewThompson64 wrote:
Deb wrote:
...When i am trying to access it, the status bar of my browser displays a message "Applet <ABCApplet> not initted" (I think it wants to say applet not initialized). Do you know how to open the Java Console? It likely contains more detail. If you get the 'red x' (or whatever it is) where the applet should appear in the page, try clicking it to open the console.
So it will be of great help, if somone can help me to understand "HOW The browser downloads an applet and where it keeps it for using it" ?I think you are getting too technical here. I have developed a number of applets, and debugged hundreds, yet I neither know, nor care, where my browser's cache is. That is the browsers business, not mine.
Some things that might help me to help you debug the problem, are for you to show the source of the applet page that loads the applet, as well as the 'directory structure' showing where that HTML is, as well as the classes or archives it uses. 
Hi Joe, Thanks for the inputs. But I tried with the firefox extension also. The browser is not requesting for the applet. :(
Also I checked the markup and found that it is perfectly fine. 
Is it possible your browser is set not to run Java? Not sure what browser or version you're running, but if Java is disabled, you'd get the applet not initted message as well.

Closing the IE browser thro' Java application

I have a requirement wherein I have to close the applications launched like (Internet exploer window) thro my java application.
Can anyone help me on this?
I tried using Runtime class Process.destroy( ) method. But still not able to find the exact one.
Go back to your first post from today.
There are people trying to help you over there.
(and you responded to them before creating this post)

Getting installed plugins list.

How can i know which plugins installed on client side? I know that i can do it using JavaScript but is it possible to get plugin information in a servlet (without using JavaScript) using a request object (and or other objects like session, application, page Context).
My problem is that i had to get these details when a session starts but i don't know where and when a session will start. Also i just need to know about java and flash plugin.
I know that my question is dumb but if you can please guide me.
Thanks in advance. 
use HttpSession.getSession(boolean) method put false inside.If session already exists it will give reference or else it won't .I had did something in java & flash.What else you want to know ? 
Thanks for your response. But i don't have any problem handling sessions. My problem is that i need to know which version of Flash plugin and Java plugin installed on client side.
I think I described my problem very bad. So let me to say it once again.
I had to know version number of flash plugin and Java plugin installed on client side. I can do it with JavaScript but i want to know is it possible to do the same with server side API? And browser will send this information to server (which seems to be not). I don't know where and when a session will start and it can be any page so i cannot change main page and add required JavaScript code for detecting version numbers.
Thanks again. 
You can't do that. You are limited to what the HttpRequest will send, which is usually little more than the browser name and version.
If you can't do something in JavaScript that then posts that info back to the server, you may try to do something like running a small, invisble applet that does that and transfers the info back to the server. There may be examples of this somehwere on this forum. 
Excuse me for delay.
Yes you are right and thanks for your response. It seems that i cannot do it in server side.

window.close no longer working

Having found the following here on the forums a few months ago we have been successfully using it to close our web browser when exiting our forms application:
Web.show_document('javascript:window.opener=self;javascript:window.close();', '_self');
However, in the last week this functionality has stopped working - but only a few users PCs. Has anyone else experienced this? I'm sure its a browser setting (IE6), but which one?
Thankyou in advance.
if for a test you remove "javascript:window.opener=self", does it bring up teh windows IE message alerting you that a program tries to close the browser ?
If yes then add teh javascript:window.opener=self snippet to the HTMLbeforeForm argument in teh formsweb.cfg file as in this case it seems that IE has a problem with executing 2 command on the browser URL
Thankyou for your response, I tried the change you suggested but I didn't get the expected message.
We have recently applied a security patch to IE and I am liasing with our operations guys to determine if the application of this patch has resulted in the problem we are now experiencing. I will update the thread with any further info.
Thanks again.
OK, we have managed to prove that the application of the IE patch:
Cumulative Security Update for Internet Explorer 6 Service Pack 1 (KB867801)
does stop the javascript from closing the IE window when exiting forms. Can anyone else confirm this, have they applied this security patch yet? We are experiencing this on 2K and XP.
My question now is, what can I do about the problem? Is this MS problem, Oracle problem or our own problem? Is there an alternative method to closing the window?
I raised a TAR on this issue and have had the following response:
"Please check this article at Microsoft's site:;en-us;330913
Microsoft Knowledge Base Article - 330913 You Can Only Use Trusted Documents to Open Other Documents in the My Computer Zone
"Because of the new security code checks, documents in the Internet zone cannot have access through hypertext reference (HREF) links or scripting to documents in the My Computer zone. Only documents located in the Trusted sites zone or the My Computer zone can access documents in the My Computer zone. Therefore, if you want to permit untrusted documents to access documents in the My Computer zone, you must add the source URL in the Trusted sites zone. Do so with caution and careful thought to prevent a potential security weakness."
Since web.show_document uses showDocument, this is the same problem you faced."
So, the use of Javascript to close the browser window is something that will no longer be supported in IE when issued through web.show_document? I'm deferring to your knowledge really as I don't quite understand the implications of what I am being told.
as far as I understand you have one options:
Add the server that you run Forms on (the Forms Services) to your list of trusted sites. If you are in an intranet, then trusting the server side shouldn't be an issue
I tried your suggestion but unfortunately it appeared to make no difference, however, I have found that if I place the Javascript code in a close.html file:
and call this file through web.show_document the window is closed as expected. So:
Web.show_document('http://.../close.html', '_self');
works, but:
Web.show_document('javascript:window.opener=self;javascript:window.close();', '_self');
does not. Are these interpreted differently? Adding the Forms Server as a trusted site made no difference to either of these methods.
you can also place the following code into your formsweb.cfg
HTMLbeforeForm=<script type="text/javascript">function close_applet() { window.opener = self; window.focus(); window.close(); } </script>
And issue a
WEB.SHOW_DOCUMENT ( 'javascript:close_applet()', '_self' );
in your form. Works for me without a problem.
Hi Patrick
I tried your suggestion but I get the same problem that I currently have, for people who have installed the Security Patch I mentioned previously, your solution will not work. It works on those machines that haven't installed it, but for people like myself the solution doesn't work. It appears to suffer from the same problem as the Javascript solution in my original post.
Have you installed the latest IE security patch? Are you running against IE?
We are also having the problem with the javascript we have been using. Ours is:
We have used that to take the user back to their html menu when they exit a form. After applying the security patch, that no longer works for us.
Will the option of putting the javascript code in a close.html file take the user back to their original menu? I can test this, but not until tomorrow morning. 
Hi Deborah
It does sound as though you are experiencing the same problem, so yes, if you create a HTML file with your piece of javascript and call that through web.show_document instead of issuing the command directly it should work.
Thanks, Richard. I'll give it a try and let you know how it goes.
Also, we have asked Microsoft to open a tar with Oracle about this issue. They have agreed. I'll let you know how that turns out. 
the Javascript call is best added in an onLoad event of the HTML <body> element. This way it gets executed immediatly after the page loads.
If all this doesn't help, there is one more option i can imagine, which is to write a Java Bean in Forms that uses the JSObject class to issue the window.close() command from within the page.
Unfortunately I don't have an environment setup that allows me to test this idea, which is why I just bring it up. If all your efforts fail, I still could build the bean and ask one of you to test it.
Frank and Richard,
I tried the HTML file approach and it does seem to work with the javascript that Richard suggested. It closed the browser when I exited the form. However, what I want to do is to take the user back to the html page that they used to link to the form - which is why I used the history javascript I listed above. But, since I am a javascript 'borrower' and not a coder, I don't know how to code that in the html page approach. Can either of you assist?
OK, I got my version of this working by creating the onLoad handler like:
<body onLoad="javascript:history.go(-2)">
I called the html page with that code with a web.show_document from the form. Then, when the user exits the form, they are taken back to the originating html page.
The only bad thing about this is that our developers will have to touch every form to put this change in. I'm not going to be a popular person around here tomorrow!

IE 5 Crashing

Hi All,
I am in a critical position now. Whenever I run my web page,IE 5 browser crashes. I am using javascript, servlets and html for creating that web page. Is there anyone who come across this situation. Can anybody tell me when the browser crashes? Are there any debugging tools for debugging my web page? I am in urgent need of this one.
Please help me,
Thanks in advance,
I am in a critical position now. Whenever I run my
y web page,IE 5 browser crashes.IE 5 is pretty stable on my Win2k box. I hate to say it, but it's better than Mozilla in that regard.
If you have the opportunity, check your web page from another box, to ensure that not your machine's system has been corrupted.
I am using
javascript, servlets and html for creating that web
page. Is there anyone who come across this situation.Your problem description is too general.
Are there any debugging tools for debugging my web page? Just for the integrity of HTML, tidy is a nice tool.
But I would be surprised if a malformed HTML page is enough to tear down IE nowadays.
You could also try to disable part of the mechanisms, like JavaScript, just to see, if the page still leads to crash without that feature. It might help to track the problem down.
Hi Marc,
Thank you for your suggetions. I think my problem mostly related to javascript code. Its my assumption but not confirmed that javascript objects will be created in the memory space of the browser. So, whenever any malformed functionality was done which is not handled by the browser, then it may crash I think. I tried to debug the script with Microsoft's script debugger. But, I didn't find any help from that. Can you suggest me any alternative I can use?
I tried to debug the script with Microsoft's script
debugger. But, I didn't find any help from that. Can
you suggest me any alternative I can use?Sorry. I stick to "printf" style debugging for JavaScript, as I don't use it for anything longer than a few lines.