CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2000
    Location
    Romania, Cluj-Napoca
    Posts
    57

    Building An Executable Jar

    Hi !!!
    I try run a stand-alone application from a jar file and it is not working. I will give the details below.

    1. I have a jar file called Hello.jar with the following content
    - directory META-INF which contains the file MANIFEST.MF
    - directory tests which contains the file HelloWorld.class.
    In the HelloWorld.class the method main is implemented.

    2. The file MANIFEST.MF has the following format:

    Manifest-Version: 2.0
    Main-Class: tests.HelloWorld
    Created-By: 1.3.0 (Sun Microsystems Inc.)
    My-Information: this is my own added field

    The lines and the end of file are properly ended with a CR\LF pair.

    As far as I read from SUN documentation there are 2 ways to execute the code from Hello.jar
    1. java -cp Hello.jar tests.HelloWorld
    2. java -jar Hello.jar -> which uses the MANIFEST.MF file for the
    detection of the main class.

    Unfortunately none of the above methods are working.
    Where is the mistake ????
    By the way, as OS I am using WIN 2K PROFESSIONAL.

    PS: I attached the jar file to this post.
    The good answers will be rewarded !!!!
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2002
    Location
    Halifax, NS, Canada
    Posts
    985

    HelloWorld

    I didn't see a problem with your ManiFest.
    Sorry I had to decompile your program in order to see the problem.

    Your problem is your main method.

    Your main Method should be:
    [javacode]
    public static void main(String args[]) {

    // you have
    public void main(String params[])
    [/javacode]

  3. #3
    Join Date
    Jan 2002
    Location
    Halifax, NS, Canada
    Posts
    985
    It's been a while since I've been here. It looks like the tags for code have changed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured