0

Ok, so I am very new to Java. I find it really hard. I have an assignment from school that is almost finished, except one thing. Creating a runnable .jar file. I have googled myself crazy.. When I clean and build my project a jar file is created. It has a manifest file too, but it does not include my start class. I did try and change this in properties, so when I check it actually says wich class is the start class. But, it does however not end up in the manifest file. This is due to some bug? I have tried to just open up the .jar, change the manifest file so it does say correct startfile. By adding this line: Main-Class: uppgift4.RunGame But it still does not run as it should. I just get en error message which says check the console..

I really don't know what I am doing wrong...!! Any ideas? Im on a Mac OS and I don't use winzip to unzip files.

//Therese

  • Mac OS has a terminal. Please open the terminal, change directory to where your JAR file is. Type the following command: `java -jar myJar.jar` substituting, of course, your JAR file name for "myJar". Please copy/paste the result and edit your question. (Yes, I know this question will never get updated, but maybe someone else will find this comment useful.) – Thufir Mar 21 '13 at 14:49

1 Answers1

0

Usually, when problems like this occur, there are a couple things you should take a look at:

  • Does your program run in netbeans with the "run" button?
  • Do you have a static main function in your "start class"
  • Does netbeans know which class contains this main?

    Once you have those ironed out and netbeans is running the program, if there are still problems, it may help to ask on the netbeans forums about why your compiled jar does not run (there may be a problem with the netbeans made ANT script). You should not need to edit the manifest file yourself. Hope this helps.

  • SuperTron
    • 4,203
    • 6
    • 35
    • 62