1

I have my first application written in Netbeans, with supporting libraries. After building the project, the file NetbeansProjects/PDF/dist/PDF.jar runs fine.

I'm ultimately trying to build a OSX app, but think(?) that the first step is to bundle the PDF.jar and the /lib/*.jar files together.

To this end, I'm using JarSplice, but can't work out how set the Main Class. I think it should be found in the manifest.mf file, but it doesn't seem to contain anything. JarSplice requests:

Enter your applications main class file below, complete with any packages that it maybe in. E.g: my package.someotherpackage.MainClass

Adding System.out.println(main.getClassName()); to my main method gives me "PDF" in the output window of Netbeans.

Can someone tell me how I go about finding the main class, and ideally, because I'm an idiot, exactly what to input into as the main class into JarSplice?

The Guy with The Hat
  • 10,836
  • 8
  • 57
  • 75
Ben Mayo
  • 1,285
  • 2
  • 20
  • 37
  • What is 'getClassName()'? Do you mean 'getClass().getName()'? – user207421 Dec 10 '13 at 22:45
  • The code I used to try and determine the main class was: `StackTraceElement[] stack = Thread.currentThread ().getStackTrace (); StackTraceElement main = stack[stack.length - 1]; String mainClass = main.getClassName (); System.out.println(main.getClassName());` Exactly what it is doing I must confess I do not know, but it outputs "PDF" which is the name of the class which contains the main method – Ben Mayo Dec 10 '13 at 22:46

1 Answers1

0

It depends were you put your main class when developing. Try the class name that contains your main method, if you put your main method in Test.java then put;Test

If your main class is nested in a package then put something like org.package.Test

Once you export your .jar open up the Manifest file and next to Main-Class: should have the main class, just copy and paste

  • Manifest file simply con taints "X-COMMENT: Main-Class will be added automatically by build" However, your first sentence contained the answer....which was simply "PDF". So I feel pretty silly... – Ben Mayo Dec 10 '13 at 22:52