On my work computer, I have Windows 7 x64 with JDK 1.7 installed. I created a project in Netbeans and all went well. I then copied my project onto my home computer that is running Mac OS X 10.6, which is running JDK 1.6. The build fails with an error message about an unsupported major.minor version .51. Googling and searching concludes that it is because of a JDK version mismatch. Oracle does not allow JDK 1.7 to be installed on Mac OS X 10.6, so I am stuck with JDK 1.6 on my Mac.
Is there a way I can take my 1.7 code and get it to build and run on my Mac OS X 10.6 running JDK 1.6? Or is there way I can take my code back to my JDK 1.7 machine and downgrade the compatibility to 1.6? Basically I need the code to run on my work computer and home computer.
This will require you to have Java 1.6 installed on you Windows box. There a syntax incompatibilities between 1.7 & 1.6 (as well as some API differences).
In Netbeans, right click the project node and select “Properties”. From the properties dialog, select sources. At the bottom of the dialog, you should see “Source/Binary Format”, from the drop down, select “JDK 6”
Select “Libraries”. At the top of the dialog, you should see “Java Platform”, from the drop down, you will need to select “JDK 1.6”
If you can’t find it, click “Manage Platforms”. Click “Add Platform”, browse to where you installed Java 6 (usually in C:\Program Files\Java) and select it. Click “Finish”.
Now you should be able to find it
UPDATE
From comments made by “su-“, you may be able to get away with simply changing the “Source/Binary Format” option to 1.6