Thursday, June 17, 2010

Rmoving Restrictions on package like sun.*, java.*

The java.*, javax.* and org.* packages documented in the Java Platform Standard Edition API Specification make up the official, supported, public interface. If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.
The sun.* packages are not part of the supported, public interface.
A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.


Due to the same a project give access restriction errors at the compile time ...
Access restriction: Class is not accessible due to restriction on required library";
may be shown while developing Java projects in Eclipse IDE.

Solution: follow the following steps to solve the same

1.(Your Project) Properties -> Java Compiler -> Errors/Warnings


This was all about eclipse when you deploy the same using Felix
you can either pass the VM argument as:

-Dorg.osgi.framework.bootdelegation=sun.*,com.sun.*

or you can add

Dorg.osgi.framework.bootdelegation=sun.*,com.sun.*

in the config.properties file in the conf folder of the Felix Framework





References:

1 http://java.sun.com/products/jdk/faq/faq-sun-packages.html
2 http://lkamal.blogspot.com/2008/09/eclipse-access-restriction-on-library.html
3 http://blog.springsource.com/2009/01/19/exposing-the-boot-classpath-in-osgi/





No comments:

Post a Comment