diff --git a/src/main/assets/JRE-17.zip b/src/main/assets/JRE-21.zip similarity index 70% rename from src/main/assets/JRE-17.zip rename to src/main/assets/JRE-21.zip index 4b8f269a..5e8ca320 100644 Binary files a/src/main/assets/JRE-17.zip and b/src/main/assets/JRE-21.zip differ diff --git a/src/main/java/pojlib/UnityPlayerActivity.java b/src/main/java/pojlib/UnityPlayerActivity.java index 81bdcad7..6ee1786e 100644 --- a/src/main/java/pojlib/UnityPlayerActivity.java +++ b/src/main/java/pojlib/UnityPlayerActivity.java @@ -53,15 +53,15 @@ protected String updateUnityCommandLineArguments(String cmdLine) mUnityPlayer = new UnityPlayer(this, this); setContentView(mUnityPlayer); mUnityPlayer.requestFocus(); - File zip = new File(this.getFilesDir() + "/runtimes/JRE-17.zip"); + File zip = new File(this.getFilesDir() + "/runtimes/JRE-21.zip"); if(!zip.exists()) { try { - FileUtils.writeByteArrayToFile(zip, FileUtil.loadFromAssetToByte(this, "JRE-17.zip")); + FileUtils.writeByteArrayToFile(zip, FileUtil.loadFromAssetToByte(this, "JRE-21.zip")); byte[] buffer = new byte[1024]; ZipInputStream zis = new ZipInputStream(Files.newInputStream(zip.toPath())); ZipEntry zipEntry = zis.getNextEntry(); while (zipEntry != null) { - File newFile = newFile(new File(this.getFilesDir() + "/runtimes/JRE-17"), zipEntry); + File newFile = newFile(new File(this.getFilesDir() + "/runtimes/JRE-21"), zipEntry); if (zipEntry.isDirectory()) { if (!newFile.isDirectory() && !newFile.mkdirs()) { throw new IOException("Failed to create directory " + newFile); diff --git a/src/main/java/pojlib/util/JREUtils.java b/src/main/java/pojlib/util/JREUtils.java index ee620464..37c292ed 100644 --- a/src/main/java/pojlib/util/JREUtils.java +++ b/src/main/java/pojlib/util/JREUtils.java @@ -130,7 +130,7 @@ public void run() { public static void relocateLibPath(final Context ctx) { sNativeLibDir = ctx.getApplicationInfo().nativeLibraryDir; - LD_LIBRARY_PATH = ctx.getFilesDir() + "/runtimes/JRE-17/bin" + "/lib64/jli:" + ctx.getFilesDir() + "/runtimes/JRE-17/lib:" + + LD_LIBRARY_PATH = ctx.getFilesDir() + "/runtimes/JRE-21/bin:" + ctx.getFilesDir() + "/runtimes/JRE-21/lib:" + "/system/lib64:/vendor/lib64:/vendor/lib64/hw:" + sNativeLibDir; } @@ -138,14 +138,14 @@ public static void relocateLibPath(final Context ctx) { public static void setJavaEnvironment(Activity activity) throws Throwable { Map envMap = new ArrayMap<>(); envMap.put("POJLIB_NATIVEDIR", activity.getApplicationInfo().nativeLibraryDir); - envMap.put("JAVA_HOME", activity.getFilesDir() + "/runtimes/JRE-17"); + envMap.put("JAVA_HOME", activity.getFilesDir() + "/runtimes/JRE-21"); envMap.put("HOME", Constants.MC_DIR); envMap.put("TMPDIR", activity.getCacheDir().getAbsolutePath()); envMap.put("VR_MODEL", API_V1.model); envMap.put("POJLIB_RENDERER", "regal"); envMap.put("LD_LIBRARY_PATH", LD_LIBRARY_PATH); - envMap.put("PATH", activity.getFilesDir() + "/runtimes/JRE-17/bin:" + Os.getenv("PATH")); + envMap.put("PATH", activity.getFilesDir() + "/runtimes/JRE-21/bin:" + Os.getenv("PATH")); File customEnvFile = new File(Constants.USER_HOME, "custom_env.txt"); if (customEnvFile.exists() && customEnvFile.isFile()) { @@ -164,8 +164,8 @@ public static void setJavaEnvironment(Activity activity) throws Throwable { Os.setenv(env.getKey(), env.getValue(), true); } - File serverFile = new File(activity.getFilesDir() + "/runtimes/JRE-17/lib/server/libjvm.so"); - jvmLibraryPath = activity.getFilesDir() + "/runtimes/JRE-17/lib/" + (serverFile.exists() ? "server" : "client"); + File serverFile = new File(activity.getFilesDir() + "/runtimes/JRE-21/lib/server/libjvm.so"); + jvmLibraryPath = activity.getFilesDir() + "/runtimes/JRE-21/lib/" + (serverFile.exists() ? "server" : "client"); Log.d("DynamicLoader","Base LD_LIBRARY_PATH: "+LD_LIBRARY_PATH); Log.d("DynamicLoader","Internal LD_LIBRARY_PATH: "+jvmLibraryPath+":"+LD_LIBRARY_PATH); setLdLibraryPath(jvmLibraryPath+":"+LD_LIBRARY_PATH); @@ -193,6 +193,9 @@ public static int launchJavaVM(final Activity activity, final List JVMAr } } + userArgs.add("-XX:+UseZGC"); + userArgs.add("-XX:+ZGenerational"); + userArgs.add("-Dorg.lwjgl.opengl.libname=" + graphicsLib); userArgs.add("-Dorg.lwjgl.opengles.libname=" + "/system/lib64/libGLESv3.so"); userArgs.add("-Dorg.lwjgl.egl.libname=" + "/system/lib64/libEGL_dri.so"); @@ -201,7 +204,7 @@ public static int launchJavaVM(final Activity activity, final List JVMAr userArgs.addAll(JVMArgs); System.out.println(JVMArgs); - runtimeDir = activity.getFilesDir() + "/runtimes/JRE-17"; + runtimeDir = activity.getFilesDir() + "/runtimes/JRE-21"; initJavaRuntime(); chdir(Constants.MC_DIR); @@ -220,7 +223,7 @@ public static int launchJavaVM(final Activity activity, final List JVMAr */ public static List getJavaArgs(Context ctx) { return new ArrayList<>(Arrays.asList( - "-Djava.home=" + new File(ctx.getFilesDir(), "runtimes/JRE-17"), + "-Djava.home=" + new File(ctx.getFilesDir(), "runtimes/JRE-21"), "-Djava.io.tmpdir=" + ctx.getCacheDir().getAbsolutePath(), "-Duser.home=" + Constants.MC_DIR, "-Duser.language=" + System.getProperty("user.language"),