add a way to use java21

This commit is contained in:
ShirosakiMio 2024-01-15 12:45:49 +08:00
parent 8e75b28c19
commit 83a41e5877
1 changed files with 15 additions and 0 deletions

View File

@ -50,9 +50,24 @@ public class ShellActivity extends FCLActivity {
if (cmd.endsWith("\n")) { if (cmd.endsWith("\n")) {
logWindow.appendLog("->" + cmd); logWindow.appendLog("->" + cmd);
editText.setText(""); editText.setText("");
String javaDir = FCLPath.RUNTIME_DIR + "/java";
if (cmd.contains("clear")) { if (cmd.contains("clear")) {
logWindow.cleanLog(); logWindow.cleanLog();
return; return;
} else if (cmd.contains("java21")) {
shellUtil.append("cd " + javaDir);
if (!new File(javaDir, "jre21").exists() && !new File(javaDir, "jre17_").exists()) {
shellUtil.append("cp " + new File(new File(FCLPath.SHARED_COMMON_DIR).getParentFile(), "jre21.zip").getAbsolutePath() + " ./");
shellUtil.append("unzip jre21.zip");
}
shellUtil.append("mv jre17 jre17_");
shellUtil.append("mv jre21 jre17");
return;
} else if (cmd.contains("java17")) {
shellUtil.append("cd " + javaDir);
shellUtil.append("mv jre17 jre21");
shellUtil.append("mv jre17_ jre17");
return;
} }
shellUtil.append(cmd); shellUtil.append(cmd);
} }