Results 1 to 4 of 4

Thread: How to run a jar file

  1. #1
    Join Date
    Aug 2009
    Posts
    51

    How to run a jar file

    I created a small jar file called HelloWorld using Matlab Java Builder tool. But although creating the jar file so good, I could not run it. What is the exact command to use? On internet, it said to use this:
    Code:
    % java -classpath D:\Matlab\toolbox\javabuilder\jar\javabuilder.jar;hello.jar examples.hello
    but this does not work!

    It gave me the error as:
    '%' is not recognized as internal or external command, operable program or batch file.
    If I remove the %, the error is:
    Failed to load Main-Class manifest attribute from D:\Matlab\toolbox\javabuilder\jar\hello.jar
    Can you help me please?

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to run a jar file

    Try the following from MS-DOS console:

    Code:
    java-jar hello. jar

  3. #3
    Join Date
    Aug 2009
    Posts
    51

    Re: How to run a jar file

    Thank you for your response, DOS returns an error of Manifest:

    Code:
    Failed to load Main-Class manifest attribute from 
    hello. jar
    This is the event in question (open with Eclipse):

    Code:
    Manifest-Version: 1.0
    Created-By: 1.6.0_16 (Sun Microsystems Inc.)

  4. #4
    Join Date
    May 2008
    Posts
    271

    Re: How to run a jar file

    you can extract the contents of your file with the command hello.jar
    Code:
    jar xvf hello.jar
    Your manifest must be of type
    Code:
    Manifest-Version: 1.0
    Main-Class: Hello 
    Class-Path: ./
    Hello is the main class (containing the method "main")

Similar Threads

  1. Replies: 4
    Last Post: 04-04-2012, 01:12 AM
  2. Replies: 4
    Last Post: 07-02-2011, 10:19 AM
  3. Replies: 3
    Last Post: 28-01-2011, 06:26 AM
  4. Replies: 1
    Last Post: 17-07-2009, 07:09 PM
  5. Replies: 3
    Last Post: 16-07-2009, 01:29 PM

Tags for this Thread

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
  •  
Page generated in 1,751,831,442.27854 seconds with 16 queries