How to use package from com.sun

| | August 4, 2015

I’m working on a commercial software which needs the package com.sun.rowset.CachedRowSetImpl
I tried many times import the package but many times unsuccessful because I use OSGI and this makes the import of the package very difficult.

I found the original source code here:

http://www.docjar.com/html/api/com/sun/rowset/CachedRowSetImpl.java.html

One quick way will be just copy the code and use it. But if I do this I may violate the license because my application source code is closed. Can you give me some advice how I can solve this issue?

One Response to “How to use package from com.sun”

  1. When you start an OSGi framework. It supplies all of the base, system packages, to the environment as part of the framework bundle.

    There is a restriction on that. By default it doesn’t supply any of the com.sun.* classes that comes with Java as they aren’t considered part of the “java library”

    To get these classes into the OSGi environment you just need to use a fragment bundle that will extend the framework bundle and expose the required classes.

    I highly recommend reading this blog post by Felix Meschberger who walks through an example of this process

    http://blog.meschberger.ch/2008/10/osgi-bundles-require-classes-from.html

Leave a Reply