building jar
Hello everyone! I have quite nasty thing happening,i dont understand wheres the problem! Im using Netbeans IDE 5.5! As i understand when I press Build Project button it builds the project and it is ready for use! Everything is ok when Im running application from dist folder, but only then when it is also seen in Netbeans 5.5 projects! I can't run it on another computer where JRE is the same, SO i guess theres something wrong with classpaths! :( When Im looking to manifest.mf i see only this:
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Is it normal? Or it hasn't added main class yet?
and else - i i try to run jar file through command cmd java it says unable to access jarfile MyTableModel.jar
Tnx
[779 byte] By [
kode128a] at [2007-11-27 3:22:18]

# 2
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.6.0_01-b06 (Sun Microsystems Inc.)
Main-Class: MyTableModel.MyTableApp2
Class-Path: lib/swing-layout-1.0.jar
X-COMMENT: Main-Class will be added automatically by build
And Im running Windows XP with SP2
And for Swing layout manifest is:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.4.2_08-ea-b01 (Sun Microsystems Inc.)
X-COMMENT: Main-Class will be added automatically by build
Message was edited by:
kode128
# 4
Tnx for responding
Yes, its in Source package->MyTableModel package-> MyTableApp2.java!
I took all dist folder, in that folder there are MyTableModel.jar, Readme file and lib folder with swing -layout -1.0
Readme contents are:
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "MyTableModel.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* If the classpath contains a folder of classes or resources, none of the
classpath elements are copied to the dist folder.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
# 5
>java -jar "MyTableModel.jar"
I think that run command is rather : java -jar MyTableModel.jar
Try to create manually the executale jar like the following:
- go to the dist directory and copy the MyTableModel package to another location (create a directory called "jar" for example)
- in the "jar" directory create a META-INF directory
- in the META-INF directory, create a MANIFEST.MF file that contains :
Manifest-Version: 1.0
Class-Path: lib/swing-layout-1.0.jar
Main-Class: MyTableModel.MyTableApp2
- APPEND TWO empty lines to the manifest file(manifest.mf)
- open MS-DOS and go to the "jar" directory. example : C:\MyProject\jar\
- type : jar cvfm MyTableModel.jar META-INF/MANIFEST.MF *
try this jar on another machine and let us know what will happen.
Hope That Helps