How to configure the SDK's default JDK?

I recently installed SDK 3.5.2 and have begun using it.

I’d like to use JDK 17 for all my development work, but by default the SDK sets all new projects to use JDK 11. I had the same issue with NetBeans, of course, and by now I’m tired of manually re-configuring every new project and sub-project using “Properties” → “Build” → “Compile”.

Does anyone know how to alter the default JDK in JMonkeyEngine SDK 3.5.2?

I think the jdkhome settings in etc/jmonkeyengine.conf will set the JDK that runs both the SDK/NB/Gradle and will be used as the default for projects.

1 Like

That appears to work for Temurin JDK 11 but not for Temurin JDK 17.

With 17, the loading window appears but not the main window.

Update: In my my Netbeans 15 installation, I pointed netbeans_jdkhome at Temurin JDK 17, and that worked perfectly. This seems to indicate a divergence between JME SDK and Netbeans.

I’m not at my computer currently so this is not super accurate… But what I do is let the SDK run on JDK 11. But I configure the JDKs I have (8, 11 & 17 at the moment) from the Installed JDKs menu in SDK/NB. And set the JDK 17 as default. That is it.

I think the default JDK is persisted in Ant projects, and you should also configure it to build.gradle in Gradle projects. SDK, and Netbeans, will honor this if you have the specified JDK listed. Gradle projects at least will give an error if they are configured with a different JDK than you have available.

It is Tools → Java Platforms. Add all that you use, and select the default.

1 Like

Could be LWJGL 2, it is allergic to newer JDKs…

People say stuff like this… I’m using JDK18 with lwjgl2 without any apparent issues.

sgold’s problem also seems 100% to do with how one particular IDE is configured over another. Not sure what any version of lwjgl has to do with that.

We would need the logs. But this happens to me also in Linux with some newer JDKs, but curiously not in Windows. And the culprit, well, the one suffering, is the LWJGL 2 in my case. But yeah, lets see the logs. If it is something we could fix, that would be great.

In my understanding we don’t have any more configuration than the branding. Module configuration (IDE modules) may vary. But that is also pretty much the default NB catering, or a subset of it.

Note: this is not about SDK not starting or apps not starting. This is about the build files that are generated and that they use the wrong version in the build files.

I fail to see how an lwjgl version (or any random jar version for that matter) could affect the build files that are generated. But maybe there is some stupidly ludicrous level of magic going on that I don’t understand.

Thanks, Toni!

In NB 15, I go Menu Bar → “Tools” → “Java Platforms” to reach the “Java Platform Manager” dialog. I can select “Java 17” as a platform. Clicking the “Close” button makes it the default.

In SDK 3.5, “Java 17” doesn’t appear as a platform, only “Java 8” and “Java 11”. I can select “Java 8”, but then clicking the “Close” button doesn’t change the default. Clicking “Add Platform” allows me to download JDK 17, but clicking “Close” with that selected still doesn’t change the default.

We would need the logs.

I’d be happy to supply logs. I’d just need instructions on how to generate/access them.

Hmm, it seems so that you can’t choose the default. You are correct. Probably because of the bundled version. Then you are just down to having it in your project configurations. For me this at least works and is persisted.

Notice however, you can also locate it from your disk. No need to download it if you already have. If NB 15 knew these before hand, it might be the settings persisted from previous versions also. SDK also persists the settings but we advice to delete them as too old settings might actually break the SDK. Something with the module configuration. Or then it is simply just smarter, even we use the same installer too.

The log can be viewed by View → IDE log. But in case of a crash the log is found (I tested the accepted answer and it works for me):

1 Like

When I set netbeans_jdkhome="/usr/lib/jvm/Temurin/jdk-17.0.4+8" in /home/sgold/netbeans-15/etc/netbeans.conf, my Netbeans 15 startup succeeds and the logfile at /home/sgold/.netbeans/15/var/log/messages.log gets updated.

When I set jdkhome="/usr/lib/jvm/Temurin/jdk-17.0.4+8" in /home/sgold/jmonkeyplatform/etc/jmonkeyplatform.conf, my SDK 3.5 startup terminates prematurely and silently and the logfile at /home/sgold/.jmonkeyplatform/dev/var/log/messages.log contains:

-------------------------------------------------------------------------------
>Log Session: Thursday, November 17, 2022 at 1:20:42 PM Pacific Standard Time
>System Info: 
  Product Version         = jMonkeyEngine SDK v3.5.2-stable
  Operating System        = Linux version 5.15.0-53-generic running on amd64
  Java; VM; Vendor        = 17.0.4; OpenJDK 64-Bit Server VM 17.0.4+8; Eclipse Adoptium
  Runtime                 = OpenJDK Runtime Environment 17.0.4+8
  Java Home               = /usr/lib/jvm/Temurin/jdk-17.0.4+8
  System Locale; Encoding = en_US (jmonkeyplatform); UTF-8
  Home Directory          = /home/sgold
  Current Directory       = /home/sgold
  User Directory          = /home/sgold/.jmonkeyplatform/dev
  Cache Directory         = /home/sgold/.cache/jmonkeyplatform/dev
  Installation            = /home/sgold/jmonkeyplatform/jmonkeyplatform
                            /home/sgold/jmonkeyplatform/extide
                            /home/sgold/jmonkeyplatform/groovy
                            /home/sgold/jmonkeyplatform/harness
                            /home/sgold/jmonkeyplatform/ide
                            /home/sgold/jmonkeyplatform/java
                            /home/sgold/jmonkeyplatform/nb
                            /home/sgold/jmonkeyplatform/platform
  Boot & Ext. Classpath   = 
  Application Classpath   = /home/sgold/.jmonkeyplatform/dev/lib/jfluid-server-15.jar:/home/sgold/.jmonkeyplatform/dev/lib/jfluid-server-cvm.jar:/home/sgold/.jmonkeyplatform/dev/lib/jfluid-server.jar:/home/sgold/jmonkeyplatform/platform/lib/boot.jar:/home/sgold/jmonkeyplatform/platform/lib/org-openide-modules.jar:/home/sgold/jmonkeyplatform/platform/lib/org-openide-util.jar:/home/sgold/jmonkeyplatform/platform/lib/org-openide-util-lookup.jar:/home/sgold/jmonkeyplatform/platform/lib/org-openide-util-ui.jar
  Startup Classpath       = /home/sgold/jmonkeyplatform/platform/core/asm-9.3.jar:/home/sgold/jmonkeyplatform/platform/core/asm-commons-9.3.jar:/home/sgold/jmonkeyplatform/platform/core/org-openide-filesystems-compat8.jar:/home/sgold/jmonkeyplatform/platform/core/core.jar:/home/sgold/jmonkeyplatform/platform/core/asm-tree-9.3.jar:/home/sgold/jmonkeyplatform/platform/core/core-base.jar:/home/sgold/jmonkeyplatform/platform/core/org-openide-filesystems.jar:/home/sgold/jmonkeyplatform/platform/core/org-netbeans-libs-asm.jar:/home/sgold/jmonkeyplatform/jmonkeyplatform/core/locale/core_jmonkeyplatform.jar
-------------------------------------------------------------------------------
INFO [org.netbeans.modules.netbinox]: Install area set to file:/home/sgold/jmonkeyplatform/
1 Like