Is it possible to switch between Jdks in Netbeans working on a Maven web project?

Asked

Viewed 186 times

1

I’m working with the java7 but now I have other projects Maven webthat were built for the platform java8, I’m using Netbeans 8.0.2. Before when I was just creating the web java project (not Maven), I had two JDKs ,7 and 8 properly installed, could click mouse button on the project go in properties and choose the platform for the project normally. When I try to do the same with a project Maven web can’t.

2 answers

2


You are unable to switch between platforms because there is probably only one set in the IDE settings.

The @Diegofelipe suggested a way to resolve, but in addition it is possible to include and/or remove platforms directly from the IDE. In the top menu there is the option Tools, inside there’s another call Java platforms:

ferramentas > plataformas java

Accessing this option will be possible to manage existing platforms.
To add a new one just click on Add Platform... and select the directory (local or remote) where the JDK is located.

plataformas java

After that you’ll be able to switch between platforms by accessing the properties of any Java project.


In Maven projects, to change the JDK, right-click on the project name and on the tab Compile options for existing platforms - and the button Manage Java Platforms... that will take you to the same window that I explained above.

compilar


If you still need to change the format of the source code, access the project properties and in the tab Source code, change the source code format to 1.8 if you are writing in Java8:

códigos-fonte

  • Thanks for the attention! Even in a web Maven project? I think I’ve done it !! And it hasn’t changed at all!!

  • I’ve already made the change through etc netbeans.conf !! In this example of yours it’s easy to switch from IDE without problems, try doing the same with a Maven web project!

  • For platform change with java if there is no error this is the way you taught, but I want platform change for a web project Maven !!

  • 1

    I’ve edited once more, if not this... I can’t imagine what your question is.

  • That’s right, thanks for the patience man!! Just one more thing when I click on the project with the right click not leaving the option to compile, you have the option Set Configuration and then Customize and only then there is Compile tab .

  • That’s right, thanks for the patience man!! Just one more thing when I click on the project with the right click not leaving the option to compile, you have the option Set Configuration and then Customize and only then there is Compile tab .

  • Don’t worry anymore !! It’s all worked out well friend!! Your answer helped a lot!! A hug!! The fight for everything!

Show 2 more comments

1

It is possible to change the version of the JDK in netbeans by file netbeans.conf, which is in the folder C:\Program Files\NetBeans 8.0.2\etc, if your netbeans is x86, the folder will be C:\Program Files(x86)\NetBeans 8.0.2\etc.

Look for the line netbeans_jdkhome and change according to JDK’s address, it is usually C:/Program Files/jdk<versao>, or if it is an x86(32 bit) version of jdk, will be in C:/Program Files(x86)/jdk<versao>

Here follows a link where you can read how to do this Changing the Default JDK in Netbeans.

  • There is only that possibility?

  • @Penapintada usually newer versions are compatible with features of older versions, if your project is as version 8 ,I believe there are no problems.

  • Thank you for the answer! There is only this possibility, there would not be another, similar to what I did before?

  • What happens is this: I have as default the jk7 and the project requires the jk8 that is already installed on the machine!! I think your answer is the only way

  • @Penapintada make the post change that will work all the features of jdk 8 normally in your netbeans, just remember to make the change with it closed.

  • ! Thank you for your attention!! Yes I will do that!!

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.