Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Java (https://www.askmehelpdesk.com/forumdisplay.php?f=440)
-   -   To create jar file in java (https://www.askmehelpdesk.com/showthread.php?t=513678)

  • Oct 5, 2010, 02:32 AM
    ubharedev
    To create jar file in java
    Hi,
    I want to create an executable file for my console application program.
    It is a network file sharing program, need to run on double click or command line.
    This program contains 11 class files in which FileSharing.class is the main class file.
    I have created manifest.txt file with 'Class-Path: Test1/FileSharing.class' as main class file where Test1 is the package.

    Then I run the command: jar cfm FileShare.jar manifest.txt *.class
    I creates a jar file with FileShare.jar name.
    But while giving the run command from cmd.
    java -jar FileShare.jar or java -jar FileShare
    Gives the following error:
    Unrecognized option: -
    Could not create the Java virtual machine.

    Please help.

    Regards,
    Dev
  • Oct 8, 2010, 02:05 AM
    ubharedev
    Ok.
    I got the answer.
    Go to the folder where u put all class files in command prompt.
    Create manifest file.
    Type in command prompt: jar cfm jarfilename.jar manifestfilename.txt *.class
    Finish.

  • All times are GMT -7. The time now is 02:19 PM.