Swing applet view problem in IE

Hi,

I am new to Java and have to develop a web enabled tool where the servlets in my Solaris-Tomcat web server is manipulating with data in an oracle database. The client code is on Swing Applet, which is to be opened in Internet Explorer 5.5 from Windows NT platform.

In view of this, I have written a small swing applet and it is not opening in IE. I heard that I need to use HTML converter to run Swing applets in IE. But, Is it enough to download the HTML converter for Solaris and install it in the server and convert the html pages where <applet> tag is included? Or , do I need to install the HTML converter for windows to all the client machines?

Please help. This is very urgent.

Thanks in adance.

[750 byte] By [Blessy] at [2007-9-27 0:46:44]
# 1

You can use this html code :

<html>

<body>

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 695 HEIGHT = 525 codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">

<PARAM NAME = CODE VALUE = MyApplet >

<PARAM NAME = CODEBASE VALUE = "." >

<PARAM NAME = ARCHIVE VALUE = "MyApplet.jar" >

<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">

<PARAM NAME="scriptable" VALUE="false">

</OBJECT>

</body>

</html>

replacing only the dimension, the code value and removing or modifying archive value.

Don't modiy the classid. This code indicates to the browser to use the Sun Java VM instead of its own vm.

I hope this helps,

Denis

Deudeu at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 2

Thank you Denis for posting this.

What I understood from your comment is that...

1. If I give the HTML code like the way you said, I don't need to install HTML converter for Solaris, at my Web server.

2. This plugin should get automatically downloaded to the client, if it is not already installed.

3. I don't have to tell my customer to install it in their systems.

Am I right?

Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 3
You are right.Denis
Deudeu at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 4
What about opening the same in Netscape navigator? Is the same code enough?(sorry for the 2 days' break).
Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 5
I don't know but I suppose.Denis
Deudeu at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 6

If you started out with a simple applet tag like this:

<APPLET CODE="myApplet" CODEBASE="." WIDTH=200 HEIGHT=100></APPLET>

and converted it with the HTMLConverter that comes with your version of the SDK (make sure it's the same version number), your HTML file will be automatically converted to include the <OBJECT> needed by IE and the <EMBED> tag needed by Netscape. With Netscape, you can have NN4+ and NN6+. The newer NN6+ doesn't come with a Java Virtual Machine, therefore it will always need a Java plugin to run an applet. The older NN4+, like IE, has a native JVM version 1.1.5 which doesn't support swing. The kicker is that NN4+ may refuse to work even with the converted HTML file. If this is the case, click:

Edit-->Preferences-->Advanced

and make sure that Java is enabled and that the Enable Java Plugin checkbox is checked.

;o)

V.V.

viravan at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 7

I have my applet in Solaris server (with Tomcat). I have written the html as you have told and stored that also in the server. Now, from my Client machine (Windows NT 4), I tried to access the html using http request using IE 5.5. First time it asked to download plugin version 1.3. It is downloaded and installed in the browser. Now I tried to access that html. It opened the applet frame and gave an exception

"java.security.AccessControlException: access denied (java.net.SocketPermission 192 resolve)".

Why it is giving this exception?

Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 8

>Now I tried to access that html. It opened the applet frame and gave an exception

>"java.security.AccessControlException: access denied (java.net.SocketPermission 192 resolve)".

Because as is noted in the error message, your applet is trying to access a socket. Without the benefit of seeing your code, I surmise that your applet needs to be signed. Since the applet requires a plugin, here is a link to a 10 steps instruction on how to create and test your applet with a self-signed certificate:

http://developer.java.sun.com/developer/qow/archive/167/index.jsp

V.V.

viravan at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 9
I don't need to access the client machine through the applet. In that case, do I need to have a signed applet?
Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 10

>I don't need to access the client machine through the applet. In that case,

>do I need to have a signed applet?

If you can confine the applet to read only from the server where it comes from and not trying to execute local OS command or access local resources, then there is no need to sign the applet.

V.V.

viravan at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 11

> If you can confine the applet to read only from the

> server where it comes from and not trying to execute

> local OS command or access local resources, then

> there is no need to sign the applet.

My applet doesn't have any method which access the client OS. It's just getting data from the server from which it is downloaded and displayes it in a JTable.

Then why it is giving this security exception which I mentioned before? Any idea?

Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 12
Hmmm......running out of guesses but if you want to e-mail me the code to your applet, I am willing to take a look and see what I can find out. My e-mail address is vvanic@netscape.net.V.V.
viravan at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 13

> Hmmm......running out of guesses but if you want to

> e-mail me the code to your applet, I am willing to

> take a look and see what I can find out. My e-mail

> address is vvanic@netscape.net.

Sure. I'll send you my source code, by email.

Thanks,

Blessy

Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 14
> Sure. I'll send you my source code, by email.> Hi, I sent it by email.Thanks
Blessy at 2007-7-4 17:44:22 > top of Java-index,Archived Forums,Swing...
# 15

I've put your applet on my website, check it out at:

http://home.attbi.com/~aokabc/test/SwingTable.htm

I did make a small change to the SwingTable.java, which you can download via a hyperlink, by removing the package from the file. You'll notice that I'm currently running j2sdk1.4.0. You must make appropriate change to your servlet code to reflect what you see in my HTML file -- particularly the CODE and CODEBASE for the applet.

If this helps, don't forget the Dukes!

V.V.

viravan at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...
# 16

> I've put your applet on my website, check it out at:

>

> http://home.attbi.com/~aokabc/test/SwingTable.htm

>

> I did make a small change to the SwingTable.java,

> which you can download via a hyperlink, by removing

> the package from the file. You'll notice that I'm

> currently running j2sdk1.4.0. You must make

> appropriate change to your servlet code to reflect

> what you see in my HTML file -- particularly the CODE

> and CODEBASE for the applet.

>

> If this helps, don't forget the Dukes!

Hi,

I'm using j2sdk 1.3.1 in my server. Since my servlet as well as the applet are in the same location, I removed the "CODEBASE VALUE" from the html part of the servlet. Now It's giving the "ClassNotFoundException.

If I can solve this problem with ypur inputs, I'll surely give you the duke dollars!!!! :)

Blessy

Blessy at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...
# 17

>I removed the "CODEBASE VALUE" from the html part

Is not enough to just move the applet to the same location as the HTML, you must either:

1) remove the package from the program, copy the class file to the HTML location, and set the CODEBASE to ".", or

2) leave the package in but create a subdirectory with the name of the package, put the compiled code in that subdirectory and set the CODEBASE to point to the subdirectory.

BTW, have you looked at the link that I posted?

V.V.

viravan at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...
# 18

> >I removed the "CODEBASE VALUE" from the html part

>

> Is not enough to just move the applet to the same

> location as the HTML, you must either:

>

> 1) remove the package from the program, copy

> the class file to the HTML location, and set the

> CODEBASE to ".", or

>

> 2) leave the package in but create a subdirectory with

> the name of the package, put the compiled code in that

> subdirectory and set the CODEBASE to point to the

> subdirectory.

>

> BTW, have you looked at the link that I posted?

>

> V.V.

Hi,

I tried the CODEBASE the way u suggested. Now, it's giving ClassNotFound Exception.

Blessy at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...
# 19
Even if my problem still exists, In view of the useful points I have got from Denis & V.V., I like to share the duke dollars between them. How can I do it?I expect some more help from these friends to completely come out of my problem.Best RegardsBlessy
Blessy at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...
# 20
Apparantly swing applets will now work in IE 6
gcsepix at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...
# 21

>I tried the CODEBASE the way u suggested. Now, it's giving ClassNotFound Exception

Can you post a link to your modified applet and HTML?

V.V.

BTW, to assign the dukes, you simply click on the penguin[b/] icon with a plus sign next the the respondant's post and follow the instructions on how many dukes to award.

viravan at 2007-7-4 17:44:24 > top of Java-index,Archived Forums,Swing...