Zolf
asked on
Creating Jar file to run Java application
Hello there,
I have created a simple Java application and I want to proovide it to the client as Jar file. My software has a 3rd party licence which needs to be there for the application to run. I am using eclipse to bundle the applciation but when i run the application I get error saying cannot find the lic. from eclipse i have place the lic like so
static String licFilePath = "\\lib\\BarCode.lic";
and it is working fine from my eclipse. But when I run it from cmd prompt like so Z:\>java -jar demo.jar
my MANIFEST file looks like so
can somebody please help me resolve this issue.
cheers
Zulf
I have created a simple Java application and I want to proovide it to the client as Jar file. My software has a 3rd party licence which needs to be there for the application to run. I am using eclipse to bundle the applciation but when i run the application I get error saying cannot find the lic. from eclipse i have place the lic like so
static String licFilePath = "\\lib\\BarCode.lic";
and it is working fine from my eclipse. But when I run it from cmd prompt like so Z:\>java -jar demo.jar
Z:\>java -jar demo.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/se/barcode/License
at com.demo.Demo2.setLicense(Demo2.java:85)
at com.demo.Demo2.main(Demo2.java:26)
Caused by: java.lang.ClassNotFoundException: com.se.barcode.License
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 2 more
my MANIFEST file looks like so
Manifest-Version: 1.0
Class-Path: se-barcode-7.6.0.jar se.BarCode.lic
Main-Class: com.demo.Demo2
can somebody please help me resolve this issue.
cheers
Zulf
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Moussa,
l changed my Manifest file as you mentioned but still it cannot find the lic file.
l changed my Manifest file as you mentioned but still it cannot find the lic file.
You need to make sure your export options have included dependent libraries/jars
Try to define in the dependencies from command line like so
java -cp .;lib\*; -jar demo.jar
java -cp .;lib\*; -jar demo.jar
Try to define in the dependencies from command line like soThis is why it's important to be certain of your goal: is it to use one jar only?
ASKER
thanks for the comments.
How can I use one jar only??
How can I use one jar only??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
:)