| Author |
The stupidest question
|
Michael Huber
Ranch Hand
Joined: Aug 20, 2004
Posts: 43
|
|
Hello, I want to make a program that I have independant of java. I am using j2sdk1.4.1_01 and I found out that jar files are the best for this. So in my Command Prompt I type the following: jar cf Hello.java it gives me a menu but not the jar file. Anyone could give this idiot a step by step guide to creating a jar file and how to view it??? PLEASE yes I am dumb, I read the tutorial at http://java.sun.com/docs/books/tutorial/jar/basics/index.html but I still don't get it thanks, any help is much appreciated.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
Not a stupid question. If you haven't used UNIX "tar", the jar command's syntax is vaguely confusing. Your command line is simply missing the name you want the jar file to have: jar cf myjar.jar Hello.java Of course, you typically don't want to put .java files into a jar, but .class files.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
If you want to create an executable JAR, one that could be run on a properly configured system by simply double-clicking, you might like to follow the instructions in the "Creating an Executable JAR File" thread.
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
Michael Huber
Ranch Hand
Joined: Aug 20, 2004
Posts: 43
|
|
I read the instructions for creating a JAR but when I open the zip file (I use WinRAR) and double click on Hello.class (I did a quick Hello world for just to test it out) I get a file that opens and its basically all my code in funny lettering. I did everything like the post said, I just substituted all the Foo.class with Hello.class I even added a carriage return on the Main-Class: Hello thanks for all your help!
|
 |
 |
|
|
subject: The stupidest question
|
|
|