• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to run jar file?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I have got one jar file name: Append.jar. All the java files are created and compiled in JBuilder4. I would like to run this jar file without JBuilder4 environment. What is the command for this?
Any help is appreciated. Thanks!
qionghua
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Try this:
java -jar Append.jar
Regards,
Manfred.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using a Windows machine, you can run some jar's just by double clicking them.
I know it sounds a bit obvious, butit's worth a try if you're still having problems!
 
qionghua yang
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I can be able to run for the jar file which isn't included in some package. But if I have a package which includes 5 java classes. I build a jar file contains all these 5 java classes file.
The steps I use are:
1> Make a manifest file:
Main-Class: AppendInterface
2> Build the jar file:
jar -cvfm Append.jar Manifest.mf AppendInterface.class AppendApplication.class
3> Run the jar file:
java -jar Append.jar
This is the source code for AppendInterface class:
package appendpackage;
import java.awt.*;
.......
.......
public static void main(String[] args)
{
.....
}
When I run this jar file, it gave the following error "Exception in thread "main" java.lang.NoClassDefFoundError: AppendInterface (wrong name: AppendPackage/AppendInterface>
I believe this is bacause of the package definition. Does anyone know how to solve this problem? Any hints are appreciated. Thanks!
qionghua
reply
    Bookmark Topic Watch Topic
  • New Topic