This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Socket Permissions Problem using Java applet on Windows but not on Mac

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem with java.security.AccessControlException.access denied when using any Windows OS / Browser with my java applet.

I get a (java.net.socket permission [IP address]:PORT connect, resolve) error.

However, when I use a Mac OS / Browser the applet works correctly?

The service is running on a Tomcat server and I have looked into security policies but I am new to java applets / sockets etc so I am looking for some guidance.

The applet function basically allows files to be uploaded/downloaded using a MySQL database.

Can anyone help please?

Thanks



 
Sheriff
Posts: 21803
104
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Please read this for applet security issues.

I'll move this thread to our Applets forum.
 
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 things you need to do.
1. Get the system security manager to do accept your permission checks. Here are 2 examples :

Replace xxx.xxx.xxx.xxx with the server IP address.

The RunTime is for a thread (obviously).
Put the needed lines as your first code in the main method.


2. You have to sign the JAR file
i.
Fill out all this information. It will create a keystore named "keystore" (you can change it to whatever name you would like)
ii. Put a certificate on it. You could pay to have it certificated or sign it yourself :

iii.

NOTE: Remember the passwords you put in these.

Enjoy!
John Price
 
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you signed the applet and all external libraries (jars), you do not need to write permission checking code.
Remember to sign external jars as well, not only the Applet jar itself. I had permission exception problem and had not figured out until I found some external jars were not signed. I signed all of them then everything was fine.
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may also habe to run the code as privileged code, which is described in the link Rob posted.
 
Philip Underhill
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the suggestions.

I will try the jar signing and see what results I get. I am new to this so I don't want to rush into things.

Does it make any sense that the applet works in a Mac environment and not Windows?
 
Hug your destiny! And hug this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!