• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The stupidest question

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Michael Huber
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic