954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Signing Java Applets

Hi all,

Here's the problem I have. I am designing a website in HTML and I want to include a chat system using a Java applet. I have written a small example applet that just connects to my server and gets the users that are currently online. The applet works when I run it in Eclipse but I tried to launch it from the browser and I got a SocketPermission exception.

I did some reading on the subject and found out that I need to make some changes to the java.policy file in order to grant my applet access to the socket. Also I found a couple of discussions here in the forum but couldn't find anything that actually describes the process of signing the applet. I read something about using a JAR file to include all files that the applet needs (including a java.policy file) but I am not sure how to do that. In addition, I read that the policy file is contained in the Java directory on each client's machine. So my question is how can I connect my applet to the server without having the user download a policy file or having to do any configurations?

masterofpuppets
Posting Whiz in Training
272 posts since Jul 2009
Reputation Points: 20
Solved Threads: 74
 

Where are all the parts of your application(applets, html, server) and how do they communicate?
An applet can connect to the server it was loaded from.
Are you trying to connect with another server from your applet?
What code do you have on the server to control the chat sessions?

NormR1
Posting Expert
Moderator
6,677 posts since Jun 2010
Reputation Points: 1,138
Solved Threads: 656
 

Have you seen these?
http://download.oracle.com/javase/tutorial/deployment/applet/security.html
http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html

JNLP lets you get around many of the unsigned jar problems by automatically seeking permission from the user

JamesCherrill
Posting Genius
Moderator
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

Thanks for the links :) I checked them out but I decided to use Javascript and Ajax for the chat system.

masterofpuppets
Posting Whiz in Training
272 posts since Jul 2009
Reputation Points: 20
Solved Threads: 74
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: