Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I'm building java applet in notepad++ not in some IDE. How can I give this applet all permissions (for opening and writting to socket) for testing. I'm asking this because now I need to deploy applet to server each time!

If I run applet from developing computer and I want to connect to socket on server which is not on localhost I get exception.

So I'm asking if there is any way to give all or only this applet all permissions in browser?
Posted

1 solution

I'm building java applet in notepad++ not in some IDE

There's your fault. WHY?

Add a file "policy.policy" to the project and put in there the following:

grant {
  permission java.security.AllPermission;
};


the start the app with the argument:

java -Djava.security.policy=policy.policy MyFunkyApplication
 
Share this answer
 
Comments
aselan 20-Dec-12 2:41am    
At first thank you for your quick response!

I only have 320 KB space, for CSS, HTML, Java applet and JavaScript code, that's why I'm not doing this with IDE, because it generates a lot of unnecessary files.

I know about policy file, but I can't use it without IDE, or not?
TorstenH. 20-Dec-12 3:55am    
no, the argument thingy is just a fancy little confusion brought into this by me.
sure you can, how do you start the applet?

There is also a code based version, please refer to google for that.
aselan 20-Dec-12 4:09am    
I start applet in web browser, I run index.html with applet and I get security exception for opening Soceket on server machine (let's say on IP 192.168.1.10). If I upload it on server (which is on IP 192.168.1.10), it works! I would like to develop app on developmetn machine and opening socket on server. Now I must upload it each time.

I google it but you can give java applet permissions only through IDE.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900