Adding external jars

Hi there,

I cannot find a way to add external librairies (jar) to my project since I need some to run a Hive node.

I'm using v2.5.4.

Thanks for any help,

 

Charles

Hi Charles,

I think you need to bundle the jars into a separate knime plugin.

I did this for JOGL recently. The necessary steps are explained here: http://wadeawalker.wordpress.com/2010/10/09/tutorial-a-cross-platform-workbench-program-using-java-opengl-and-eclipse/

I hope this helps.

Best regards

Guido

Not necessarily. You can just place the jars somewhere in the plug-in (e.g. in a "lib" folder) and then add them in the MANIFEST.MF in Runtime->Classpath.

1 Like

I have a similar problem, and i've seen a few replies about java libraries that talk about lib directories, plugins, manifests, and i can't see any of these in my project. I have a "workflow" where i have created some custom java nodes. Rather than have to specify the required jars every time (there are many) i'd like to put all of the jars in a folder and then just tell KNIME to look at that folder. This is also because i want to export the workflow and send to other people, and when i did that it did not include the jars - but also the references were hard coded i.e. /Users/me/Desktop/knime_jar_folder etc. which won't be the same on other's machines.

 

So, i am not coding a plugin, just a normal workflow, but can't find any info on how to include the jars in a folder so you dont have to add them in every single java node - is there an easy way to do this? many thanks!

Oh, this is on a mac primarily, but i guess this could be exported to any machine. I tried adding the line to knime.ini but it had no effect

-Djava.ext.dirs=/Users/me/Desktop/knime_libs

I found a great answer to this question here which is worth repeating:

Gilbert Le Blanc:

An Eclipse plug in project manages dependencies differently than a regular Java project.

I’m assuming that you’re adding packages with .class files.

Define a library folder in your Eclipse plug-in project. Copy any external classes and / or jars to the library folder.

Open up the MANIFEST.MF file under the META-INF directory. You’ll see a formatted editor with 8 tabs on the bottom.

Click on the Runtime tab. Add the external classes and / or jars in the library folder to the Classpath. This will also add these external classes and or jars to the Java Build Path of the project.

Click on the Dependencies tab, and add the other Java projects in the Imported Packages dialog. You have to check the box labeled “Show non-exported packages”. If your other Java projects are Eclipse plug ins, add them under Required Plug-ins instead.

2 Likes

thanks,but if i add folder containing jar files in at Runtime,not work,but add all jar files work correct.