Poru
Poru

Reputation: 8360

Netbeans (Java): 3rd library works but how could I compile it into jar?

I'm using 3rd libraries (substance, trident) and I added them as libraries (I added the .jar's) to my project in Netbeans. This works also but if I use the builded jar outside the project directory it doesn't work like it should (the choosen UI don't show), I get the error:

java.lang.ClassNotFoundException: org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel

I set that UI/LookAndFeel like that in my code:

UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceOfficeBlue2007LookAndFeel");

How could I make this work/run?

Upvotes: 3

Views: 219

Answers (1)

javamonkey79
javamonkey79

Reputation: 17775

You've got 2 choices:

  1. Put the library jar on the classpath.
  2. Assemble\Build the library jar with the regular jar.

For option 1, you most likely need the jar located "near" the main jar on the file system; though, this is not necessarily a requirement. When you run the jar you then include the library jar on the classpath.

For option 2, you use some type of tool like maven's assembly plugin or the fatjar plugin in Eclipse (sorry, I don't know what the analog is in NB).

I hope this helps.

Upvotes: 3

Related Questions