Can we distributable JRE with our game because people will have to download it separately. Like if we play other games there are Packages like msvcpr (C++) 2010 etc for runtime.
Is there any open JRE like openjdk. Or we can use oracle JRE and does steam and oracle allow to bundle this with our game ?
Thanks in advance!!
Oracle have changed their license to be “less terrible” but at this point there is no point bundling an Oracle JRE, just use the OpenJDK one. In fact if you start with a JME project from
https://start.jmonkeyengine.org/ there will be a gradle task called
buildAllDistributions that will automatically create windows, mac & Linux distributions. Alternatively you can grab JREs from
https://adoptium.net/en-GB/temurin/releases manually, or from URLs like
https://github.com/adoptium/temurin11-binaries/releases/download/jdk-188.8.131.52%2B1/OpenJDK11U-jre_x64_windows_hotspot_184.108.40.206_1.zip to grab them automatically (See
https://api.adoptium.net/v3/assets/feature_releases/11/ga?image_type=jre for all the available JREs in json format).
So that’s a long way of saying: Yes, you absolutely can do that. Don’t use Oracle, do use OpenJDK’s JRE (From adoptium)
By the way you can also use tools like JavaPackager (it has a Maven and Gradle plugin) to bundle JRE with your app.
:package: Gradle/Maven plugin to package Java applications as native Windows, Mac OS X, or GNU/Linux executables and create installers for them. - GitHub - fvarrui/JavaPackager: Gradle/Maven plugin...
If you enable
customizedJre (which by default it is) it will generate a minimal JRE customized for your app which only includes the required JRE modules.
You can find a sample build config here:
If you do not want an installer you can disable it with generateInstaller = false.
Just in case, this is my java packager config that I use to package a test app for all platforms.
// common configuration
mainClass = mainClassName
bundleJre = true
customizedJre = true
generateInstaller = false
administratorRequired = false
additionalResources = files('blue-cube.l4j.ini', 'src/dist/config', 'src/dist/assets', 'src/dist…