DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Posts
    9

    help with .jar files

    It seems like all of the examples and tutorials on this are extremely vague, so I thought that someone might give me specific instructions.
    How do I make an executable .jar file out of my project? I have a simple program called calculator.java, located in C:\Java\calc\calculator.java. I gather that I need to make a manifest file manifest.mf, but what exactly do I need to put in it, and then what do I do? I think that I'm supposed to go to the command prompt and write somthing like:
    jar cfm calc.jar , with stuff after this also
    So what exactly do I do? I'm very confused that this is not easier to do in Java, it seems like there should be a simpler way of making an executable java program, like .exe's in C++, etc.
    Thanks in advance for any help!

  2. #2
    Join Date
    Mar 2004
    Posts
    635
    creating jar file from command line

    my manifest file says only this:

    Manifest-Version: 1.0
    Main-Class: MainFrame

    where MainFrame is the class with your main(String[] args) method.

  3. #3
    Join Date
    Jun 2004
    Posts
    9
    So where do I go in the command prompt? Which directory do I go to to write the command in? If I go to the directory of my project, I get an error that jar is not a recognized cammand. If I go to the java bin directory where jar.exe is, It says that it can't find the calculator class. Thanks for your reply, but I need more specifics, please.

  4. #4
    Join Date
    Feb 2004
    Posts
    541
    Go to this thread. It is a link to a tutorial for making JAR files written by the user Cjard (on a different forum, but he's also a member of this one). If you read the first few posts it gives a step by step method to create a JAR file.

  5. #5
    Join Date
    Jun 2004
    Posts
    9
    Thanks for that link! I finally got it. The problem was that I did not have jar.exe in the folder with the program in it. I don't know if it's the standard way to do it, but I put a copy of jar.exe in my program folder and then everything worked. I probably should have realized this when the error was " 'jar' is not a recognisable command". Anyway, thanks alot for the help. Problem solved.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links