• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to access SerialPort in Applets using jSSC library

eswari Malluru
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have a requirement to access serial ports from Applets. For this using jssc.jar library and try to get the list of available ports. When I am doing this getting the below exception

Exception in thread "Thread-23" java.lang.ExceptionInInitializerError
at jssc.SerialPortList.<clinit>(SerialPortList.java:43)
at SerialIO.fetchSerialPorts(SerialIO.java:204)
at Applet.startJavaScriptListener(Applet.java:174)
at Applet.mav$startJavaScriptListener(Applet.java:36)
at Applet$1.run(Applet.java:105)
at java.security.AccessController.doPrivileged(Native Method)
at printer.Applet.run(Applet.java:100)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.home" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.awt.AWTSecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at jssc.SerialNativeInterface.<clinit>(SerialNativeInterface.java:85)
... 8 more

How should I modify the java.policy to get out of this exception. Do I need to use anything else other than this jar.

I am using java 1.6.0_27 and Windows 7

Please help me in resolving this issue.

Tony Docherty
Saloon Keeper
Posts: 3154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer to your question is in the stack trace:
access denied ("java.util.PropertyPermission" "user.home" "read")

In your policy file you need to set the property permission for user.home to allow read access.

Something like:

victor sre
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To handle permission, scm uses tmp folder. The scm is an alternative library to rxtx/javaxcom.
Wiki : http://www.embeddedunveiled.com/
Repository : https://github.com/RishiGupta12/serial-communication-manager
Video : https://www.youtube.com/watch?v=fYLQbelGunQ

It supports RS-232 control signals handshaking, monitoring and has been ported to Linux, MAC, Solaris and Windows operating system. It is consistent, portable, efficient, reliable, testable, extensible, modifiable, scalable library.
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!