problem about jsr223-Collection of common programming errors


  • Mick Sear
    java ruby jruby jsr223
    I’m experimenting with the Java scripting engine and Ruby, and I’m having trouble setting some instance variables in a ruby script. This could be my lack of understanding of Ruby or my lack of understanding of how to use ruby classes in the scripting engine. With the following code:public class App {public static void main( String[] args ) throws Exception{ScriptEngineManager sm = new ScriptEngineManager();ScriptEngine se = sm.getEngineByName(“jruby”);StringBuilder sb = new StringBuilder();sb.

  • Charles
    eclipse scripting groovy jsr223
    I have a Groovy script which is run like this:File scriptFile = …; ScriptEngine engine = …; String script = FileUtils.readFileToString(scriptFile); Object evalResult = engine.eval(script, bindings);Unsurprisingly, breakpoint set in the script file doesn’t trigger. What can I change to make it work? The script needs to be run in the context of the larger program (no separate launch configuration), and through a ScriptEngine, and the file is only known at runtime.

  • Thorbjørn Ravn Andersen
    java jvm jsr223
    I have a need for providing code snippets at runtime.For this to work well, I basically need to call into the scripting language, and back into Java. For this to be usable in a debug scenario StackTraces must be usable too (so methods and linenumbers go directly to the script source like in modern JSP-pages) and Exceptions must bubble up correctly.What scripting languages – where the source is read at runtime – can provide this? JSR-223 support is a bonus.

  • jbandi
    javascript jvm javafx-2 rhino jsr223
    I am experimenting with using JavaFX 2 from JavaScript through the JavaScripting API (Rhino).Note: This is a rich-client question, nothing to do with web-programming.I would like to orchestrate some parts of my JavaFX rich-client application with dynamic scripts. I am evaluating if the JavaScripting API with the bundled JavaScript Runtime (Rhino) would be a good approach for my requirements.So my first attempt was to create a simple JavaFX-GUI through JavaScript:print(‘Starting…’)importPackage

  • Thorbjørn Ravn Andersen
    java web-services scripting jvm jsr223
    I am at a situation where I need to be able to create and expose a webservice at run time. (i.e. no “javac”-compilation step).Is there a JVM-based scripting language that has good support for JAX-WS so I can write a central engine in Java, and then just let the scripting language create the snippets containing the web service methods (with either @WebService or @WebMethod annotations) which can then be passed to http://docs.oracle.com/javase/6/docs/api/javax/xml/ws/Endpoint.html#publish(java.la

  • divs1210
    java jython jsr223
    Does JSR-223 cover the specs of the interactive interpreter that is common on all kinds of compliant languages from abcl to rhino to jython?If not, then do all these languages make their environments any way they want in Java, or are they mostly written in their own language (as libraries)?For eg: is the python interactive interpreter written in python, or in C/Java/C#, depending on where it’s running?EDIT:I’m not saying that EVERY scripting language NEEDS a REPL, but that every JVM-based script

  • user2074610
    jruby jsr223
    I have setup ant Jmeter task which gives Jmeter request with already assigned 3 properties to Jmeter test plan (JMX) ,when i was reading these properties in Jruby script(JSR223 sampler) like below (for upto first 4 threads it is getting all 3 property values correctly and assigning to localvariables (pvalue1mpvalue2)..pvalue1=$props.get(“prop1′) pvalue2=$props.get(“prop2′) pvalue3=$props.get(“prop3′)`enter code here`But problem is that from thread no 5, it is started throwing below exception [j

  • Jason S
    java rhino jsr223
    This is very similar to this other SO question about arrays.If I evaluate:y = {a: 1, b: 2, “momomomo”: function() { return “hi”; }, zz: “wham”}in a Javascript script instantiated via JSR223 (ScriptingEngine), I get a NativeObject of some sort (I see this in Eclipse’s debugger) and have no idea how to access its properties. Furthermore I don’t even know which .jar file, if any, I need to add to my build path to be able to work with the class in question, and if I find an approach that works in Rh

  • clacke
    java classloader rhino jdbc jsr223
    I’m trying to do some JDBC access from JavaScript using the Rhino included in Java 6. But I cannot make the DriverManager find the Driver I want to use.These two examples should be equivalent:Java:public class DbTest {public static void main(String[] argv) {java.sql.Connection c = null;try {java.lang.Class.forName(“net.sourceforge.jtds.jdbc.Driver”);c = java.sql.DriverManager.getConnection(“jdbc:jtds:sqlserver://myserver/mydb”, “user”, “password”);}catch (Exception e) {c = null;System.out.printl

  • joekutner
    javascript rhino jsr223
    I’m trying to read a JSON file with some JavaScript that I’m eval-ing with Rhino through the Java JSR-223 API. What I’m trying to do works with the Rhino shell, but not with the embedded Javascript in my Java code.Here’s what works:$ java -jar js.jar js> readFile(‘foo.json’); {y:”abc”}Here is what does not work:ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName(“js”); engine.eval(“readFile(‘foo.json’)”); I get this error:Exception in thread

  • extraneon
    java rhino jsr223
    In my code, all of the scripts are contained in .js files. Whenever one of the scripts contains an error, I get this:javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: “nonexistant” is not defined. (<Unknown source>#5) in <Unknown source> at line number 5What bugs me is the <Unknown Source>. Multiple files are in one ScriptContext, and it can be hard to track down an error. It also looks horrible.Is there a way to replace <Unknown So

Web site is in building