Reputation: 23
I'm currently studying a module at university about programming in java.
The IDE we are using is NetBeans and I am using Mac OS X 10.8
We have just started making a application that utilises a GUI.
I am following a worksheet and have followed it exactly.
Currently I am stuck because when I run my application the project builds fine but the GUI does not open when I run it.
My Project is built up of multiple packages and classes and I have set the GUI class as the main class.
Even more confusing to me is that I copied the project over to my Window 7 VM and it built and ran fine and the GUI came up.
Can anyone help as to why the GUI does not open on OS X and if there is a solution.
EDIT:
I get the following exception when I try to run my app on a Mac: http://pastebin.com/cySzY5Wr
Upvotes: 1
Views: 2089
Reputation: 1057
Netbeans builds you application for a specific version of Java. However when you run the applicaton it will fail to run because the executables are of a previous version. To change the target JDK/Java Version in Netbeans you need to:
Project Properties
(Right click on the project and select properties).Libraries
tab and check the JDK version. On OSX it should be JDK6 unless you've installed JDK7 from Oracle.Compile
tab(under Build
) and check that the version that Netbeans is compiling for is the same or less than the JDK you are using.You might also want to check the version of Java that you are running in the system(as this will be the version that is used when you double click on the .jar
file.). You can do this by opening up Terminal.app
(or search in Spotlight) and typing java -version
.
Upvotes: 2