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.

What JAVA classes are available in a DSS script?

I'm writing a DSS script. It seems that my script environment has access to some JAVA classes. Is there any documentation which indicates which JAVA classes I can use?

For example. I was told to use Thread.sleep() on another post. See here.

But when I look through the DSS documentation (found at ccs_base/docs) I cannot find any reference to the Thread class. Looking through the JavaScript examples (found at ccs_base/examples/DebugServerExamples), I see they import some JAVA classes with the following statement:

importPackage(Packages.java.lang)

(Note the lack of quotes and semicolon. Hmm.) I'm not importing any packages in my script, yet I seem to have access to the JAVA Thread class. I only run my DSS script inside of the CCS Scripting Console. Does this mean that someone is implicitly importing some JAVA classes?

Should I be importing the same classes for correctness?

Is is required to import classes if I choose to run my script from the command line (i.e. not inside of the CCS Scripting Console)?

Thanks
~Ramsey

  • Hi Ramsey,

    Ramsey said:
    I'm not importing any packages in my script, yet I seem to have access to the JAVA Thread class. I only run my DSS script inside of the CCS Scripting Console. Does this mean that someone is implicitly importing some JAVA classes?

    Yes. When the Scripting Console is launched, several initialization scripts are automatically run. Those scripts will import several packages, including some JAVA packages. That is why you can call Thread.sleep(), since java.lang is one of those packages. You would also notice that if you tried to run your script outside the Scripting Console (command-line DSS), your script would fail since you are not importing the packages.

    Ramsey said:
    Should I be importing the same classes for correctness?

    Yes. It is good practice to always explicitly import all packages you will need. That way you script will not be dependent on running from the Scripting Console. reimporting the package (when running from the Scripting Console) will not hurt.

    Ramsey said:
    Is is required to import classes if I choose to run my script from the command line (i.e. not inside of the CCS Scripting Console)?

    Yes, as mentioned above in my first paragraph.

    Thanks

    ki

  • OK. Understood.
    Thanks for the answers.

    ~Ramsey