troubleshooting Question

Creating Jar file to run Java application

Avatar of zolf
zolfFlag for United Arab Emirates asked on
JavaJava EE
11 Comments2 Solutions60 ViewsLast Modified:
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

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
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros