batch file/jar file

S

sihle87

hi guys,

Is there an easier way of creating a batch file or jar archive file
for my programme so that it can execute without via j-Grasp(or e-
Clipse)?

I know how to use unix. is there may'be a unix way of doing it?

-Thanks
 
K

Knute Johnson

hi guys,

Is there an easier way of creating a batch file or jar archive file
for my programme so that it can execute without via j-Grasp(or e-
Clipse)?

I know how to use unix. is there may'be a unix way of doing it?

-Thanks

Jar files can be made executable on both Windows and Linux. The exact
method varies slightly by compiler/runtime version and what other files
you need for your program to work. But basically it is;

1) Compile your program
2) Create a manifest file with at least this line;
Main-Class: YourMainClass
3) If you need other jar files you need a line in the manifest file;
Classpath: Some.jar
4) Jar up the .class files and the manifest file
5) With Fedora 8 you set the 'Open With' to Java, other Linux' I don't know

Simple enough.
 
L

Lew

Knute said:
Jar files can be made executable on both Windows and Linux. The exact
method varies slightly by compiler/runtime version and what other files
you need for your program to work. But basically it is;

1) Compile your program
2) Create a manifest file with at least this line;
Main-Class: YourMainClass
3) If you need other jar files you need a line in the manifest file;
Classpath: Some.jar

One small detail - if you have other JAR files that your JAR file needs, the
manifest needs to specify the relative path *on the file system*. You don't
nest the JARs inside the main JAR, you deploy them as a group into the file
system.

It is best to put the required JARs in the same directory as the main one, or
in a subdirectory thereof. Relative paths that move up (i.e., via "../") are
not safe.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top