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

1

I'm working with java7 but now I have other Maven web projects that were built for the java8 platform, I'm using Netbeans 8.0.2. Before when I created only the java web project (not Maven), I have 2 JDK s, 7 and 8 properly installed, I could click with the mouse button on the project to go on properties and choose the platform for the project normally. When I try to do the same with a Maven web project I can not.

    
asked by anonymous 04.09.2015 / 14:45

2 answers

2

You are not able to switch between platforms because there is probably only one defined in the IDE settings.

@DiegoFelipe suggested a way to resolve, but beyond that you can also include and / or remove platforms directly from IDE. In the top menu there is the Tools option, there is another Java Platform

Accessingthisoptionwillallowyoutomanageexistingplatforms.ToaddanewonejustclickAddPlatform...andselectthedirectory(localorremote)wheretheJDKislocated.

Afterthat,you'llbeabletoswitchbetweenplatformsbyaccessingthepropertiesofanyJavaproject.

InMavenprojects,tochangetheJDK,rightclickontheprojectnameandtheBuildtabaretheexistingplatformoptions-andthebuttonManageJavaPlatforms...thatwilltakeyoutothesamewindowIexplainedabove.

Ifyoustillneedtochangethesourcecodeformat,visittheprojectpropertiesandtheSourceCodestab,changethesourcecodefor1.8ifyouarewritinginJava8:

    
04.09.2015 / 17:30
1

It is possible to change the JDK version in netbeans, by the netbeans.conf file, which is in the C:\Program Files\NetBeans 8.0.2\etc folder, 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 as the JDK address, it is usually C:/Program Files/jdk<versao> , or if it is an x86 (32-bit) version of jdk , it will be C:/Program Files(x86)/jdk<versao>

Here is a link where you can read how to do this Changing the default JDK in NetBeans .

    
04.09.2015 / 14:53