File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Use jar file to run console based program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Use jar file to run console based program" Watch "Use jar file to run console based program" New topic
Author

Use jar file to run console based program

robin singal
Ranch Hand

Joined: Jul 18, 2007
Posts: 102
Hi

I run a console based program which contains two files , of which one contains the main. I want to run that program using jar file.
Problem encountered:
I am using javax.comm package in the program.
When i run jar file using : java -jar <filename>.jar
It gives the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/CommPortIdentifier

at ConnectModem.ModemProcess(ConnectModem.java:22)
at ConnectModem.main(ConnectModem.java:18)

My Manifest file is:

Manifest-Version: 1.0
Class-Path: comm
Main-Class: ConnectModem

How can i run the jar file???

Thanks


Life is short play hard.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
You will have to add that other jar to your classpath. Somebody else asked the same thing this morning, I think it was here. Read that thread, which will probably answer your questions.
robin singal
Ranch Hand

Joined: Jul 18, 2007
Posts: 102
Thanks
I did solved my problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use jar file to run console based program
 
Similar Threads
JAR File
problem finding resouircebundle?
Unable to create jar with specified manifest.mf
Can't run main class from JAR file
problem in loading .dll file using web start?