• Post Reply Bookmark Topic Watch Topic
  • New Topic

*.jar files  RSS feed

 
jaime craven
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah
I heard if you want to have a java file as a standalone application you need it to be a *.jar file but how do I create jar files do i need to download something to do it or?
if somebody can please help me out with this thanks, coz i want to show my mates the program I made..
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you normally have jar in your JAVA_HOME/bin/
Try 'jar' on the commandline.
If your package is 'foo' and the main-class Foo put the following a script-File (makejar.sh makejar.bat)

If you're running windows, replace the '#' with 'REM' or '@REM'
To start the file you may say:
java -jar foo.jar
and the suffix jar needs to be included in the windows-list of file extensions, where you may define that 'java -jar %1%' should be executed.
Perhaps %1% is not absolutely correct.
 
Lalit K Kumar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I guess you intend to make a bean and use it in your program.
Following are the steps to do so :-
(1)Write a javabean in jbuilder (or any other ide).Don't forget to implement java.io.serializable
(2)Make sure the CLASSPATH environment variable is set to point to all needed .class (or .jar) files
(3)Compile the bean (by using javac filename)
(4)Create a manifest.tmp file , the contents of which are
Name: SimpleBean.class
Java-Bean: True
(5)Create the JAR file by using the command
jar cfm filename.jar manifest.tmp filename.class
(6)Load the JAR file into the ToolBox. Select the File|LoadJar... menu item
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!