I have several packages in my Netbeans project.

One of these packages has a main method, which is set as the main method for the project.

I use clean and build and the Jar is created successfully, however when I try and run the .jar file The application does not run correctly.

The Main.class that I am running has buttons that create instances of other classes which are in other packages within the project, however when I run it from the command line clicking the buttons usually prints null or an exception out the the console. How would I set up Netbeans so that the .jar runs successfully?

No correct solution


"How would I set up Netbeans so that the .jar runs successfully?"

You don't. Once the jar and s built, it is, or should be, independent. NetBeans is not what's wrong with it.

You didn't specify where your NPEs are happening, but it's likely your application uses a certain file-structure, and that you're attempting to run the jar while not having or maintaining the files in the same positions or with the same names as when working with them within NB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow