quark-zju / ljudge

a backend tool for an online judge system
Other
66 stars 15 forks source link

识别不到java路径 #9

Closed SilenceHS closed 4 years ago

SilenceHS commented 4 years ago

我确信已经加了java路径到环境变量里了,/etc/profile,也能命令行使用javac和java,在ljudge/examples/a-plus-b里面运行如下语句

ljudge --max-cpu-time 1.0 --max-memory 32m --user-code a.java --testcase --input 1.in --output 1.out --testcase --input 2.in --output 2.out --debug

部分结果显示如下

0 DEBUG running: lrun --reset-env true --basic-devices true --remount-dev true --netns lrun-empty --chdir /tmp --env ONLINE_JUDGE 1 --env LANG en_US.UTF-8 --env LC_ALL en_US.UTF-8 --env HOME /tmp --env PATH /usr/bin:/bin:/etc/alternatives:/usr/local/bin --env JAVA_HOME /usr/local/java/jdk1.8 --chroot /run/lrun/mirrorfs/6d0e191bc1aaa4e9839b78c6616500fe760a18fb --bindfs-ro /run/lrun/mirrorfs/6d0e191bc1aaa4e9839b78c6616500fe760a18fb/tmp /home/runact/.cache/ljudge/tmp/27619/6c/2cabbd18ca9c0949c7cc7fcb2c2f12858f32ae --max-real-time 3 --max-cpu-time 1 --max-memory 33554432 --max-output 33554432 --max-stack 8388608 --syscalls '!execve,flock,ptrace,sync,fdatasync,fsync,msync,sync_file_range,syncfs,unshare,setns,clone[a&268435456==268435456],query_module,syslog,sysfs' --fopen-filter f:/tmp/Main.class R --fopen-filter 'm:/proc:.*/(meminfo|maps)$' a --fopen-filter m:/proc: d --hostname ljudge -- java Main <2.in >/home/runact/.cache/ljudge/tmp/27619/out-83f8013344 2>/home/runact/.cache/ljudge/tmp/27619/err-c0019dc582 at lrun (ljudge.cc:1634) 0 DEBUG lrun output: at lrun (ljudge.cc:1689) { "compilation": { "log": "", "success": true }, "testcases": [ { "error": "lrun exited with non-zero (14)", "result": "INTERNAL_ERROR", "stderr": "ERROR: exec 'java' failed (No such file or directory)\n", "stdout": "" }, { "error": "lrun exited with non-zero (14)", "result": "INTERNAL_ERROR", "stderr": "ERROR: exec 'java' failed (No such file or directory)\n", "stdout": "" } ] }

我尝试指定java绝对路径到/etc/ljudge/java/run.cmd_list 即把原先里面的 java Main 修改为 /usr/local/java/jdk1.8/jre/bin/java Main

运行后依然错误 "testcases": [ { "error": "lrun exited with non-zero (14)", "result": "INTERNAL_ERROR", "stderr": "ERROR: exec '\/usr\/local\/java\/jdk1.8\/jre\/bin\/java' failed (No such file or directory)\n", "stdout": "" }, { "error": "lrun exited with non-zero (14)", "result": "INTERNAL_ERROR", "stderr": "ERROR: exec '\/usr\/local\/java\/jdk1.8\/jre\/bin\/java' failed (No such file or directory)\n", "stdout": "" } ]

我不是很清楚,是否哪里遗忘了 附上java版本 java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

系统centos7

SilenceHS commented 4 years ago

ok我又解决了,使用centos里的yum安装openjdk即可, tar包java有点问题,也不知道哪出问题,反正用openjdk就对了