0

As we know, we are in transition between Java 7 and Java 8. I have both Java 7 and Java 8 JDK installed. However in the interests of keeping a hands-off approach I want to make java 7 JDK my default Java build environment.

Leaving Java 8 JDK installed for trials, testing, and migration.

However at the current time, Netbeans 8 insists that Java 8 is-the default.

What I'd like to set: Java 7 is default.

And only specify Java 8 on a per-project basis until I'm satisfied with the new build. At that point, I imagine we would change our default Java. The challenge is that there's no clear way to change a default Java configuration.

This is not helped by the fact that the "Java Platform Manager"is not part of "Options", and lives on the Tools menu / "Java Platforms. I have been able to to this successfully with IDEAJ when moving from Java 6 to Java 7. Everyone is using Netbeans on this project so we need to achieve the same end with Netbeans. To be clear, I'm comfortable using Java 8 for the Netbeans runtime. It is just project builds that I want as a specific Java 7 target environment.

According to the topic below: In NetBeans how do I change the Default JDK?, changing NETBEANS_JDKHOME will also change my netbeans running environment. So I would prefer to just set the build-target generally. Thanks in advance!

see also:

  1. In NetBeans how do I change the Default JDK?
  2. Netbeans v8 README: "nbjdk.active [since 5.0u1] - name of a Java platform (JDK) to use when building and running".
Community
  • 1
  • 1
will
  • 4,799
  • 8
  • 54
  • 90
  • Okay, my brain is a little washy at the moment, but couldn't you just change the "Java Platform" for each project (Project Properties->Libraries). This way Netbeans will use the specified Java Platform for that project. I'm currently mixing Java 8, 7 and 6 projects this way? – MadProgrammer Jun 02 '14 at 07:15
  • Trying to avoid change 40~say projects and then change them back later. How is that not a hack when I want to switch between different targets? – will Jun 02 '14 at 12:07

2 Answers2

0

If I understand you question properly, each project can be assigned it's own Java Platform property, for example, right click the project in question and select "Properties"...

Properties

From the properties dialog, select "Libraries" and then select the "Java Platform" you want to use...

Properties

Personally, I find having the platforms pre-configured simpler.

If you're upgrading a project, you may also need to check the "Source/Binary Format" property in the "Sources" sections (it's own the bottom), as it will stay at the level of the old version of Java (if you downgrade, it adjusts automatically)

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • No. The question is about setting the "default Target". There are notes in the README for a Netbeans 8: "**nbjdk.active** [since 5.0u1] - name of a Java platform (JDK) to use when building and running". – will Jun 02 '14 at 12:11
  • And the difference been? Each project is assigned a "platform". – MadProgrammer Jun 02 '14 at 21:11
  • I thing I described the difference. I have (say) 50 projects. I would like to swap development between 7 and 8 for several reasons; the overarching theme is migration and backward compatibility. In 'some' IDE-s you can achieve what I want by specifying "target profiles". – will Jun 16 '14 at 10:37
0

One solution is to change the netbeans configuration file netbeans.conf with is located in ...\NetBeans 8.0\etc.

But it does not work well...

The bypass we found is to spefify the jdk in the shortcut that launch Netbeans into "...\NetBeans 8.0\bin\netbeans.exe" --jdkhome "C:\Program Files (x86)\Java\jdk1.7.0_60"

Daniel
  • 3,813
  • 1
  • 13
  • 11