• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to access SerialPort in Applets using jSSC library

Posts: 11
  • 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.

Posts: 3323
  • 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:

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.
A day job? In an office? My worst nightmare! Comfort me tiny ad!
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
    Bookmark Topic Watch Topic
  • New Topic