How to create a .Jar file
Hello,
I have college project in which i have to create a JAR file but i encounter a problem.
Indeed, I am with eclipse -> export jar file, I choose the main class, it shows that JAR has been created but nothing happens when I launch it.
How is it that I could target the problem?
Thank you for your help
Re: How to create a .Jar file
Have you included all required classes to your project list, JARs should include all classes of your project, not only the class containing the main but you need to have the all the classes in that project and to that just follow the steps:
select all => "Export" => "Jar file"
Then start your. Jar
hope this solves your problem.
Re: How to create a .Jar file
The basic format of the command for creating a JAR file is:
jar cf jar-file input-file(s)
Following are the options and arguments used in this command:
- The c option indicates that you want to create a JAR file.
- The f option indicates that you want the output to go to a file rather than to stdout.
- jar-file is the name that you want the resulting JAR file to have. You can use any filename for a JAR file. By convention, JAR filenames are given a .jar extension, though this is not required.
- The input-file(s) argument is a space-delimited list of one or more files that you want to be placed in your JAR file. The input-file(s) argument can contain the wildcard * symbol. If any of the "input-files" are directories, the contents of those directories are added to the JAR archive recursively.
For more info please visit the following
http://java.sun.com/developer/Books/...ics/build.html
Re: How to create a .Jar file
- First, make sure you have installed Java 1.2 or above. This facility is not available in previous versions of Java.
- Next, create your working java system. In general, you will want to put it into a package. For this example, I created a trivial HelloWorld application that prints out "Hello World" plus the first command line argument, and placed it into the package "psae". Therefore, the HelloWorld files (HelloWorld.class, HelloWorld.java) were located in the directory psae. I tested the system to make sure it worked before going on to the next step.
Here you will get the complete step by step process for creating JAR file:
http://csdl.ics.hawaii.edu/~johnson/...jar-files.html