Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: [SOLVED]Problem with Manifest file

  1. #1
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Problem with Manifest file

    Quote Originally Posted by Wnt2bsleepin View Post
    The jar file is contained in the src directory.
    Are both your jar and the joda.jar files in the same directory? How are you running the jar?


  2. #2
    Junior Member
    Join Date
    Jan 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Manifest file

    I am running the jar with the command

    java -jar client.jar

    Here is how I am exporting it in eclipse.

    eclipse.jpg


    It's being exported as a jar file, not a runnable jar.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Problem with Manifest file

    Forget the IDE for the moment. Go into the bin directory and use the command line to jar the files (with the appropriate manifest file). Then place this jar in a directory alongside your other libraries and try to run. I mention this because my foggy memory recalls something about Eclipse packaging jar's in a strange way...trying it by hand will support this and let you know your manifest is technically correct. If so, I remember my workaround being an ANT script (you could also try to export as runnable jar)
    Last edited by copeg; January 11th, 2013 at 11:12 AM. Reason: wording

  4. #4
    Junior Member
    Join Date
    Jan 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Manifest file

    I am unsure of how to compile from the command line with my setup. I have 3 packages and I don't know how to include them with the javac command.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Problem with Manifest file

    The jar command is used to build a jar file, not the javac command.
    Here's a sample batch file I use to build a jar file:
    REM Make InstantPP.jar file 
    %DEV_DRIVE%
    SET JarName=%DEV_HOME%\JavaDevelopment\NormsDev\InstantPP\InstantPP.jar
     
    cd %DEV_HOME%\JavaDevelopment\NormsDev\InstantPP
    jar -cmf InstantPP.mnf %JarName% *.class Icons\*.png ButtonImages\*.png *.properties
     
    @REM Now pick up the Tools it needs:
     
    cd %DEV_HOME%\JavaDevelopment\
    jar -uf %JarName%   NormsTools\Bitmap*.class NormsTools\FindOurHome*.class NormsTools\SaveStdOut*.class
    @ECHO   ---- Created: %JarName% ----
    MORE
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Junior Member
    Join Date
    Jan 2013
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Problem with Manifest file

    Ok, I will run the jar command. I was running the javac command on my java files to create the class files, but I can just use the ones that eclipse generated. I need to package the client and packet packages, as well as the external jar. I will report back with my attempt.

    --- Update ---

    It indeed did work. I was able to make the jar with the jar command and putting in the packages and the jar file together into the same file. It doesn't throw the error anymore. I also exported it as a runnable jar, and it worked. Thank you

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Problem with Manifest file

    Glad you were able to get it to work.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Main-Class manifest attribute
    By JamEngulfer221 in forum Java Theory & Questions
    Replies: 2
    Last Post: May 4th, 2012, 10:05 AM
  2. [SOLVED] no main manifest attribute, in Exampletut.jar
    By Java Programmer in forum What's Wrong With My Code?
    Replies: 4
    Last Post: January 7th, 2012, 03:31 PM
  3. Problem With .Jar File
    By ajay_mitm in forum What's Wrong With My Code?
    Replies: 0
    Last Post: November 16th, 2010, 02:16 AM
  4. Help With File Problem Please
    By Superstar288 in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: November 15th, 2010, 08:28 PM
  5. greetings and a file reader problem
    By chileshe in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: October 6th, 2009, 03:45 AM