From ec743dd808fffac17dc6076180ad0621f4198271 Mon Sep 17 00:00:00 2001 From: MascoSkray Date: Fri, 8 Sep 2017 18:56:24 +0800 Subject: [PATCH] fix: change fixed jdk runtime path to latest The original judge client default uses jdk 7u76 and 8u31, and cannot change to the newest version. This commit will change the folder into _latest. Prepare for new installation script. --- judge_client/1/uoj_judger/include/uoj_judger.h | 4 ++-- judge_client/1/uoj_judger/run/run_program.cpp | 4 ++-- judge_client/1/uoj_judger/run/run_program_conf.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/judge_client/1/uoj_judger/include/uoj_judger.h b/judge_client/1/uoj_judger/include/uoj_judger.h index f256b09..c20bac4 100644 --- a/judge_client/1/uoj_judger/include/uoj_judger.h +++ b/judge_client/1/uoj_judger/include/uoj_judger.h @@ -1103,7 +1103,7 @@ RunCompilerResult compile_java7(const string &name, const string &path = work_pa executef("echo package %s\\; | cat - %s/%s.code >%s/%s/%s.java", name.c_str(), path.c_str(), name.c_str(), path.c_str(), name.c_str(), main_class.c_str()); return run_compiler((path + "/" + name).c_str(), - (main_path + "/run/runtime/jdk1.7.0_76/bin/javac").c_str(), (main_class + ".java").c_str(), NULL); + (main_path + "/run/runtime/jdk1.7.0_latest/bin/javac").c_str(), (main_class + ".java").c_str(), NULL); } RunCompilerResult compile_java8(const string &name, const string &path = work_path) { RunCompilerResult ret = prepare_java_source(name, path); @@ -1116,7 +1116,7 @@ RunCompilerResult compile_java8(const string &name, const string &path = work_pa executef("echo package %s\\; | cat - %s/%s.code >%s/%s/%s.java", name.c_str(), path.c_str(), name.c_str(), path.c_str(), name.c_str(), main_class.c_str()); return run_compiler((path + "/" + name).c_str(), - (main_path + "/run/runtime/jdk1.8.0_31/bin/javac").c_str(), (main_class + ".java").c_str(), NULL); + (main_path + "/run/runtime/jdk1.8.0_latest/bin/javac").c_str(), (main_class + ".java").c_str(), NULL); } RunCompilerResult compile(const char *name) { diff --git a/judge_client/1/uoj_judger/run/run_program.cpp b/judge_client/1/uoj_judger/run/run_program.cpp index 27d4e56..f9fd872 100644 --- a/judge_client/1/uoj_judger/run/run_program.cpp +++ b/judge_client/1/uoj_judger/run/run_program.cpp @@ -208,10 +208,10 @@ void parse_args(int argc, char **argv) { string pre[3] = {"/usr/bin/python3.4", "-I", "-B"}; run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 3); } else if (run_program_config.type == "java7u76") { - string pre[3] = {abspath(0, string(self_path) + "/../runtime/jdk1.7.0_76/bin/java"), "-Xmx1024m", "-Xss1024m"}; + string pre[3] = {abspath(0, string(self_path) + "/../runtime/jdk1.7.0_latest/bin/java"), "-Xmx1024m", "-Xss1024m"}; run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 3); } else if (run_program_config.type == "java8u31") { - string pre[3] = {abspath(0, string(self_path) + "/../runtime/jdk1.8.0_31/bin/java"), "-Xmx1024m", "-Xss1024m"}; + string pre[3] = {abspath(0, string(self_path) + "/../runtime/jdk1.8.0_latest/bin/java"), "-Xmx1024m", "-Xss1024m"}; run_program_config.argv.insert(run_program_config.argv.begin(), pre, pre + 3); } } diff --git a/judge_client/1/uoj_judger/run/run_program_conf.h b/judge_client/1/uoj_judger/run/run_program_conf.h index a475462..7535d86 100644 --- a/judge_client/1/uoj_judger/run/run_program_conf.h +++ b/judge_client/1/uoj_judger/run/run_program_conf.h @@ -389,7 +389,7 @@ void init_conf(const RunProgramConfig &config) { soft_ban_file_name_set.insert("/etc/nsswitch.conf"); soft_ban_file_name_set.insert("/etc/passwd"); - add_file_permission(abspath(0, string(self_path) + "/../runtime/jdk1.7.0_76") + "/", 'r'); + add_file_permission(abspath(0, string(self_path) + "/../runtime/jdk1.7.0_latest") + "/", 'r'); readable_file_name_set.insert("/sys/devices/system/cpu/"); readable_file_name_set.insert("/proc/"); statable_file_name_set.insert("/usr/java/"); @@ -421,7 +421,7 @@ void init_conf(const RunProgramConfig &config) { soft_ban_file_name_set.insert("/etc/nsswitch.conf"); soft_ban_file_name_set.insert("/etc/passwd"); - add_file_permission(abspath(0, string(self_path) + "/../runtime/jdk1.8.0_31") + "/", 'r'); + add_file_permission(abspath(0, string(self_path) + "/../runtime/jdk1.8.0_latest") + "/", 'r'); readable_file_name_set.insert("/sys/devices/system/cpu/"); readable_file_name_set.insert("/proc/"); statable_file_name_set.insert("/usr/java/");