apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.67k stars 856 forks source link

Netbeans 12.5 imported older project cannot be loaded - Unsupported class fle major version 61 #3517

Closed paratechnical closed 2 years ago

paratechnical commented 2 years ago

Apache NetBeans version

Latest release

What happened

Netbeans 12.5 - It worked in Netbeans 11 When I open the project I get this error

image

When I tell Netbeans that I want to resolve it it doesn't work and I get this warning. image

Could not run build action using connection to Gradle installation 'C:\Users\ff.gradle wrap per\dists\gradle-7.0-bin\2p9eb qfab irfozi6 760gco7n\gradle~

Could not open cp_int generic class cache for intialzation script "c:\Program Files\NetBeans-12.5\netbeans\extide\modules\gradle\nb-toolng.gradie’ (C:\Users\ffi.gradie\caches\7.0\scripts\dtnvzzibbagvwi42m3qn4ji).

Could not open cp_int generic class cache for intialzation script ‘c:\Program Files\NetBeans-12.5\netbeans\extide\modules\gradle\nb-tooing.gradie’ (C:\Users\ffi.gradle\caches\7.0\scripts\dtnvzzibbagvwi42m3qn4ji).

BUG! exception in phase 'semantic analysis'in source unit‘ BuidScript_' Unsupported class fle major version 61

Unsupported class fie major version 61

I tried changing the gradle version in Tools->Options->Java->Gradle to 6 doesn't seem to change anything because the warning still mentions gradle 7. I tried changing the java version but that doesn't seem to work either.

image

I tried deleting the cache both in the project and in the gradle folder C:\Users\.gradle

How to reproduce

create a gradle project in netbeans 11 open in netbeans 12

Did this work correctly in an earlier version?

Operating System

Windows 10 Pro

JDK

17.0.1

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

Code of Conduct

neilcsmith-net commented 2 years ago

Possibly try unticking the option to prefer the Gradle wrapper that comes with the project. You can update the wrapper in that project later if you want to reenable that option.

cc/ @lkishalmi is there an easier way to handle this? Maybe need a wrapper update UI? Or am I missing there is one somewhere?

lkishalmi commented 2 years ago

Well, there is no real workaround can be don on NetBeans side. NetBeans 12.5 does not really support running on JDK 17. We have NetBeans 12.6 for that. Also NetBeans 13 will report such issues more detailed to users.

lkishalmi commented 2 years ago

Just briefly: Due to limitations in Gradle, it's no matter what version you set for Gradle, or JDK, the project introspection will happen with the JDK the IDE is running on, starting with the Gradle Tooling API the IDE is provided with. If the Tooling API does not support the JDK the IDE is running on, then this is what happens. Gradle 7.3 is the first one which supports JDK 17 as runtime. We were lucky with 12.6 that Gradle released that just a few days before our last release candidate.

neilcsmith-net commented 2 years ago

Sorry, @lkishalmi missed the 12.5 in there. So, yes, @paratechnical please upgrade to 12.6, or try out a 13 rc.

However, I have noticed a similar issue on 12.6 with projects with an older wrapper and JDK 17.