Now with the Ubuntu error report , it has not yet responded to this entry. (I'm still interested to see if anyone sees this behavior outside of Ubuntu.)
The reproducer and some versions where it is and did not break
I wrote a short projector that illustrates the problem on the Ubuntu Trusty system used by the person reporting it to me. He sent me this summary of the results:
Fail /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java
Fail /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
Fail /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java
Pass /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
(Darn, I did not know what specific versions were, but he recently installed them from the Ubunty Trusty repositories. Version 7 is 1.7.0_95, as he previously reported.)
I tested the same player in these versions on Red Hat without any crashes, so it starts to look like a build problem with Ubuntu.
Pass OpenJDK 1.6.0_38 (rhel-1.13.10.0.el6_7-x86_64)
Pass OpenJDK 1.7.0_95 (rhel-2.6.4.0.el6_7-x86_64 u95-b00)
Pass OpenJDK 1.8.0_71 (build 1.8.0_71-b15)
Here is the reproducer. Passprints a single integer, usually zero (it can be different from zero on a platform where echoit is not a command it ProcessBuildercan run). Failis an exception:
javax.script.ScriptException: sun.org.mozilla.javascript.EvaluatorException: Java constructor for "java.lang.ProcessBuilder" with arguments "string,string,sun.org.mozilla.javascript.ConsString" not found.
Annnd ... here is the code:
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class jstest {
public static void main(String[] args) throws Exception {
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine testEngine =
mgr.getEngineByMimeType( "application/javascript");
String testScript =
" var key = 'something';\n" +
" var tpr = 'echo';\n" +
" var pb = new java.lang.ProcessBuilder(tpr, '--', '--'+key);\n" +
" pb.start().waitFor();\n";
System.out.println(testEngine.eval(testScript));
}
}
Updated update
The reporter for this problem (to me) explained that he is launching the OpenJDK build, not (as I thought) Oracle. OpenJDK 7 seems to be packaged for Ubuntu Trusty. I inferred my version from the top of the Maven log running in this JVM, which comes out:
Java version: 1.7.0_95, vendor: Oracle Corporation
, , , , Oracle 1.7.0_95. ( , Java- Maven , JVM, .)
, Oracle 1.7.0_95.
JDK 1.7.0_80 ( 1.7, Oracle), JavaScript . , , , Oracle. , , , .
, . ( " . ", .)
, Java javax.script JavaScript, , , Rhino Java SE 6 7, Nashorn Java SE 8. , 6, 7 8, , , , , , .
, Oracle Java OpenJDK 1.7.0_95 (, , ), JavaScript. , + , sun.org.mozilla.javascript.ConsString. String ( replace, Java-, , String , ..). s1 + s2, String(s1 + s2), .
, , :
var pb = new java.lang.ProcessBuilder(pgc, '--'+key);
, , 2 String('--'+key), :
javax.script.ScriptException: sun.org.mozilla.javascript.EvaluatorException: Java constructor for "java.lang.ProcessBuilder" with arguments "string,sun.org.mozilla.javascript.ConsString" not found.
, , , :
javax.script.ScriptException: sun.org.mozilla.javascript.EvaluatorException: Java constructor for "java.lang.ProcessBuilder" with arguments "string,string" not found.
, ProcessBuilder , , List<java.lang.String> variadic (java.lang.String...), JavaScript ( ) .
, , , script; . bisect Oracle JRE 7, , . , ?