This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HOWTO add a user .jar to DSS.BAT javascript *with* eclipsec.exe - Need to use CCS GUI eclipse simultaneously with rhino debugger with .js with user supplied .jar

Other Parts Discussed in Thread: CCSTUDIO

Please give me directions on how I can add my own .jar files to DSS.BAT and still use eclipsec.exe to start CCS eclipse.


I have recently found out how to use DSS.BAT to launched the Rhino debugger with launching CCS eclipse gui.

This capability of dual debug, both rhino debugging javascipt and CCS debugging of C, is critically important a large multicore project that I am working on.

To have this capability  I need to be able to specify to the new DSS.BAT that launches eclipsec.exe to have rhino import my own java .jar files.

From a previous post I know that I can add my own .jar files to standalone rhino with java.exe. But having DSS.BAT start rhino via java.exe in place of eclipsec.exe  precludes me lauching CCS.


From the response from my previous post It appears that I should be able to add my .jar with some type of eclipsec.exe .init file changes. ( e2e.ti.com/.../423378 )


So far I have be unsuccessful in searching the Internet for instructions how to add my .jar's to the eclipsec.exe rhino session within the TI DSS.BAT.


Please help me with this eclipsec.exe .init configuration problem.


Andrew

  • Hi Andrew,

    You have two options:

    1) add -dev <Path>\external.jar to whatever script that execute eclipsec.exe. i.e "eclipsec.exe -dev c:\temp\my.jar", use comma to separate the jar files.

    2) drop your jars into the jre runtime under <installpath>\ccsv6\eclipse\jre\lib\ext

    I hope this will help you to get your jar into the runtime classpath.

    Regards,
    Patrick

  • I will try those options. Thanks!
    Andrew
  • I tried both 1) and 2) and neither appear to work.

    So far my java class path does not include my .jar files.

    Here is what I tried and the results:



    Here is the Win7 cmd.exe DSS.BAT output with"@echo on"
    ...
    C:\ti\ccsv5\ccs_base\scripting\bin>if "" == "" goto EndArgLoop

    C:\ti\ccsv5\ccs_base\scripting\bin>REM use the new headless script launcher

    C:\ti\ccsv5\ccs_base\scripting\bin>if 1 == 1 (!DEBUGSERVER!\..\..\eclipse\eclipsec.exe -dev C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\Release\od.jar,C:\opencv-2.4.10\build\java\opencv-2410.jar -nosplash -application com.ti.ccstudio.apps.r
    unScript -dss.debug -dss.rhinoArgs "C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\js_ED5B_sandbox\run_ed5b_sandbox_rhino_debugger_css.js" ) else (!DEBUGSERVER!\..\..\eclipse\eclipsec.exe -dev C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDe
    vice\Release\od.jar,C:\opencv-2.4.10\build\java\opencv-2410.jar -nosplash -application com.ti.ccstudio.apps.runScript -dss.rhinoArgs "-dss.debug C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\js_ED5B_sandbox\run_ed5b_sandbox_rhino_debugger_css
    .js" )
    Loaded FPGA Image: C:\ti\ccsv5\ccs_base\common\uscif\dtc_top.jbc
    ...


    To see what the java class path is for my .js file I did the following.
    At the beginning of my .js I put in the javascript code
    ...
    var class_path_string = java.lang.System.getProperty("java.class.path");
    System.out.println("java.class.path");
    System.out.println(class_path_string);
    System.out.println("\n");

    ...

    and the corresponding Win7 cm.exe output is

    ...
    java.class.path
    C:\ti\ccsv5\ccs_base\scripting\bin\..\..\DebugServer\..\..\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
    ...

    So it appears that I do not have my .jar files in the java classpath.

    The runtime error dipslayed in the rhino console when I try to call my method is,
    ...
    Exception - error in the while() loop
    org.mozilla.javascript.EcmaError: TypeError: write is not a function, it is org.mozilla.javascript.NativeJavaPackage. (C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\js_ED5B_sandbox\run_ed5b_sandbox_rhino_debugger_css.js#574)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
    at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
    at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3235)
    at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3254)
    at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3309)
    at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1991)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2932)
    at script.perform_io(C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\js_ED5B_sandbox\run_ed5b_sandbox_rhino_debugger_css.js:574)
    at script.doEverything(C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\js_ED5B_sandbox\run_ed5b_sandbox_rhino_debugger_css.js:282)
    at script(C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\js_ED5B_sandbox\run_ed5b_sandbox_rhino_debugger_css.js:317)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
    at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
    at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:503)
    at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:425)
    at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:391)
    at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:382)
    at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
    at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
    at org.mozilla.javascript.Context.call(Context.java:528)
    at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:450)
    at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
    at org.mozilla.javascript.tools.debugger.Main.main(Main.java:255)
    at com.ti.ccstudio.apps.internal.scripting.RunScript$1.run(RunScript.java:86)

    FInally, I will add that the code did work with rhink invoked in the DSS.BAT via the older "java.exe js.jar" mechanism.
  • I tried this on ccsv6 and both methods work for me, I was able to load the java package inside the scripting console.

    Can you try this and see if it works for you or not, dropping the jar into the ext folder inside eclipse/jre or using the -dev argument when starting eclipsec.exe or ccstudio.exe.

    In the scripting console, enter the following steps:

    importPackages(Package.<your fully qualified package>)
    var temp = new AClass()
    temp.doSomething()

  • Maybe the difference is that I have ccs5.5 and not ccs6.

    As you know DSS.BAT can invoike rhino with two mechanisms:
    1) java.exe js.jar
    2) eclipsec.exe

    My .js definitely works via older, "java.exe js.jar".
    But that does not allow launching ccs from within the .js.

    With the older "java.exe js.jar" I get the correct java.class.path that includes my .jar's:

    C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\Release\od.jar;C:\opencv-2.4.10\build\java\opencv-2410.jar;C:\ti\ccsv5\ccs_base\DebugServer\packages\ti\dss\java\js.jar;C:\ti\ccsv5\ccs_base\DebugServer\packages\ti\dss\java\dss.jar;C:\ti\ccsv5\ccs_base\DebugServer\..\dvt\scripting\dvt_scripting.jar



    With "eclipsec.exe" I only get the java.class.path:

    C:\ti\ccsv5\ccs_base\scripting\bin\..\..\DebugServer\..\..\eclipse\\plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar

    Which clearly does not have my .jar's in the path.

    I edited DSS.BAT to force it to be called with the "-dev" option as follows:

    !DEBUGSERVER!\..\..\eclipse\eclipsec.exe -dev "C:\rio_c66xx_standalone_ccs5\hello_GenericC66xxDevice\Release\od.jar,C:\opencv-2.4.10\build\java\opencv-2410.jar" -nosplash -application com.ti.ccstudio.apps.runScript -dss.debug -dss.rhinoArgs "%ArgsAfterFirst%"

    And I do have my .jar files in C:\ti\ccsv5\eclipse\jre\lib\ext as follows in this console log output cmd.exe:

    C:\ti\ccsv5\eclipse\jre\lib\ext>dir/b
    dnsns.jar
    localedata.jar
    meta-index
    od.jar <=== USER .JAR NUMBER 1
    opencv-2410.jar <=== USER .JAR NUMBER 2
    RXTXcomm.jar
    sunjce_provider.jar
    sunmscapi.jar

    will re-read your email.
    Andrew
  • Andrew,

    The java.class.path is set by eclipse to point to the launcher.jar, you shouldn't rely on this property to determine whether your jar is loaded into the jvm or not.

    One quick question, did you import the java package in your javascript file? i.e importPackage(Packages.xyz)

    I have attached an example jar file that I built for testing this issue, can you give this a try? com.ti.test.zip

    Rename the .zip extension for the attached file to .jar.

    In your script, try the following:

    importPackage(Packages.com.ti.test)
    print(new Echo().say("hi"))

    You should see hi in the console output.

    Patrick

  • Yes, the example works. I will see if I can create the smallest case where my class gives the error. I have a class that calls OpenCV to save memory as a .bmp file.

  • Thanks for creating and sending me the test.
  • How to I specify the Win7 library search path as input to eclipsec.exe library search path?

    I have a smaller sample of code that works with java.exe but not with eclipsec.exe.
    The difference between my sample code and the one that you provded (" com.ti.test.zip" ) is that I call a .jar, that calls the OpenCV jar, which in turn invokes (via JNI?) the OpenCV .dll.

    I suspect that it is eclipsec.exe has a custom mechanism to set the library search path and eclipsec.exe is not using the Win7 "PATH" environment variable. The mechanism "java.exe js.jar" *does* use the Win7 "PATH" environment variable.

    Andrew
  • Print out what is System.getProperty("java.library.path") and add your dll into this location. Or you can append the dll location into the java.library.path using the System.setProperty("java.library.path", libPath) API.

    Patrick