Adding Exteneral Libraries to an Extension in 11gR2

I mentioned this recently in a comment response, but it has come up enough times now, that it deserves it's own topic.


MANIFEST.MF

If this is a new project in 11gR2, you should already see a MANIFEST.MF file in your project in the same location as the extension.xml.

If you don't see it, add the file in the META-INF folder along with the extension.xml file.
Add the default 3 lines to the file of:
Manifest-Version: 1.0
Bundle-ClassPath: .
<blank line>

Adding an External Library

external:$ORACLE_HOME$/jdeveloper/mydir/mylib/myjar.jar

Using the default above, and this example line, the Bundle-ClassPath would look like.

Bundle-Classpath: ., external:$ORACLE_HOME$/jdeveloper/mydir/mylib/myjar.jar

You can verify that your external library is being added to the bundle by right-clicking on the project in the navigator panel, and selecting "Deploy To Target Platform".  In the Deployment tab of the Log window, click on the link to the deployed package and open the manifest.mf file to make sure everything is listed as you want it to.


If you find that the MANIFEST.MF is not being merged after you do the "Deploy to Target Platform", do the following to force the merge.

Go to project properties and click on the Deployment section. Select the "Extension" deployment profile and click on Edit.


Add the path to your new MANIFEST.MF file to the "Add additional manifest files..." section.


You usually do not need to do the step above, but I have had people tell me that the merge isn't happening for some reason, and this fixes it in those cases.

Comments:

hello

actually im working with 11gR1 (11.1.1.4) and im developing an extension for the sql developer.
i need an embedded DB but I am unable to load a DB driver (sql-lite 3.7.2) because there is no class file available after deploying
i guess error has something to do with the way I added the external sql-lite.jar
I already added the sql-lite.jar in the project properties (Libraries and Classpath) and "Deploy by Default" is set
I also tried to add it the way you described it with the manifest file, but it doesn't work

any suggestions how I can solve that problem?

PS: I tried another DB library as well (H2 DB) but it didn't work either.

Posted by Charly Regensburger on June 01, 2013 at 09:55 AM PDT #

Hi Charly,

The manifest file is only used with 11gR2. In your case, you need to add a dependency in the extension.xml file to the wherever you are going to place the library when your extension is deployed.

You can go to the extension.xml file in editor and add a dependency via the visual editor, or you can manually edit the extension.xml file yourself.

A reminder that while SQL Developers is based on the JDeveloper framework, they do have their own extension development process, and not everything that can be done to extend JDeveloper, will work, or work the same with SQL Developer.

Posted by John "JB" Brock on June 01, 2013 at 10:26 AM PDT #

hi john

thanks for your answer
its works now, but only when I deploy my extension and start sql developer separately. thats to say, it does not work when I right click on my extension in jdeveloper and click on "run extension" because jdeveloper class loader cant find the necessary driver class.

it does work, as I mentioned, when i deploy it to the extension directory of my sql developer
(I put the necessary jars in a separate folder within the sql developer dir and added the class paths in extension.xml) .. I hope thats the right way because I don't know how to add a dependency because in my visual editor I can't search for any jars, can I somehow?

Posted by Charly Regensburger on June 02, 2013 at 05:20 AM PDT #

hello JB

i am deploying my ejb jar that needs jasper libs included but i am unable to include it in deployment.

i am using oracle 11g r2 project is migrated from 10g and i have no manifest file
what shuld i try?
i tried it by deployment profile hit an trials but no luck

thanx

Posted by guest on July 02, 2013 at 06:10 AM PDT #

I don't believe that just migrating your older 10g project over to 11gR2 is going to work for you.

I would suggest creating a new "Extension" project in 11gR2 and copying your code over to that project. It will get all of the appropriate files in place and will be much easier to maintain going forward.

Once you have done that, you should be able to add your external file reference to the manifest.mf file and build your extension bundle properly.

Posted by John "JB" Brock on July 02, 2013 at 06:55 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

profile image
My name is John 'JB' Brock.
This Blog will focus on tips and tricks for working with the JDeveloper Extension SDK.
I hope to bring clarity to some of the mysteries around developing extensions for JDeveloper.


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today