Java running external jar without IDE? -


I have written a Java program that reads an excel file with jxl.jar. It is currently working, but I have to use CMD to run the program. Double click jar file does not work. These commands are compiled I code and I used to run:

  javac -classpath C: /workspace/jxl.jar :. main.java GUi.java jar cvfm run.jar manifest.txt Main.class GUI.class GUI $ 1.class GUI $ 2.class GUI $ 3.class main $ 1MyCustomTableCellRenderer.class main $ 1YourTableCellRenderer.class main $ MyCustomTableCellRenderer.class Java -cp Run.jar main  

I'm not really sure why this is different from double clicking. I have compiled the jxl file in the run.jar file, so I do not know why this does not work? The

an example directly from Java tutorial In his commentary as suggested by @MadProgrammer.

We want to load classes in the code> MyUtils.jar in the class path for use in MyJar.jar . These two jar files are in the same directory

To create a text file of the first name we have Manifest.txt with the following content:

  class -path: MyUtils.jar  

Warning: text file must end with a new line or carriage return . The last line will not be properly parsed that it does not end with a new line or carriage return.


We make Fill a jar file name MyJar.jar the following command:

  jar CFM MyJar.jar Manifest. Txt MyPackage / * class  

This creates a Jar file with the following content with a manifest. :

  appear, version 1.0 class path: MyUtils.jar built-by: 1.7.0_06 (Oracle Corp.)  

MyJar.jar is run, so now the MyUtils.jar code is loaded in the square path.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -