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 3 of 3

Thread: `No main manifest attribute, in filename.jar` after compiling a project in Github

  1. #1
    Junior Member
    Join Date
    Jul 2023
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default `No main manifest attribute, in filename.jar` after compiling a project in Github

    It is first time for me to use Java script but I need to compile the following project in GitHub to implement some analyses.
    This question may be too ambiguous to answer, but it would be helpful if someone could help how to run it.

    github.com/p3et/dmgm
    (please add https:// in front)

    I am working under the following environment:
    Windows 10 Home, version 22H2
    Maven 3.9.3
    java version 1.8.0_331
    Java(TM) SE Runtime Environment (build 1.8.0_331-b09)
    Java HotSpot(TM) 64-Bit Server VM (build 25.331-b09, mixed mode)
    javac 1.8.0_331

    At first, I downloaded zip file and opened it in Visual Studio Code from 'open folder', then `clean` and `install` the project under `demo` and `dmgm` folder under `maven`.
    (I am not sure which folder is correct to run, but I tried both)

    Somehow I could compile it and I found 'demo-1.0-SNAPSHOT.jar' was created in 'dmgm-master\demo\target' and `dmgm-master\target`, then I ran the file from PowerShell or prompt by the following script:
    (Again I am not sure which .jar file to run, but I tried both)

    cd [directory to the file]
    java -jar .demo-1.0-SNAPSHOT.jar

    However, it returned an error `no main manifest attribute`.
    I have searched the reason and found that it happens as this project does not contain `manifest.mf`.
    I understood that this file is used to specify the `main class` to start with the program.
    However, there is no `main.class` anywhere in the folder.

    I am stacking with this issue and looking for the right way to implement this repository.
    Thank you in advance for your support.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: `No main manifest attribute, in filename.jar` after compiling a project in Github

    the `main class` to start with the program
    That would be the class that contains a main() method. It does not need to be named: main.class

    I do not know how to use those tools to create a jar file. I use the jar command.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    hsjava (July 23rd, 2023)

  4. #3
    Junior Member
    Join Date
    Jul 2023
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: `No main manifest attribute, in filename.jar` after compiling a project in Github

    Thank you for your advice and please wait for a while to confirm the files/scripts in the project folder.
    I cannot make enough time to check it now but will do that.

Similar Threads

  1. i get a error Failed to load Main-Class manifest attribute
    By Deepdiddi in forum Object Oriented Programming
    Replies: 0
    Last Post: January 17th, 2014, 08:25 AM
  2. Main-Class manifest attribute
    By JamEngulfer221 in forum Java Theory & Questions
    Replies: 2
    Last Post: May 4th, 2012, 10:05 AM
  3. [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
  4. Replies: 2
    Last Post: October 30th, 2011, 06:37 PM
  5. className.main(new String[]{"filename.txt"}); - Help
    By knightmetal in forum Java Theory & Questions
    Replies: 4
    Last Post: August 25th, 2011, 07:22 AM

Tags for this Thread