Invoking the Java Virtual Machine
The Java from C++ invoker is included into the archive of the Scriptol to C++ or binary executable compiler.
Why Java?
Scriptol, with just import statements and nothing else, allows to
use Java classes and call their methods exactly as Scriptol classes
and methods...
You can program with the clear and modern syntax of Scriptol, and
still use the huge library of Java and also Java classes written by
yourself or third parties...
The Java runtime includes:
- Graphical user interface.
- 2D graphics.
- 3D graphics.
- Sound, speech.
- XML.
- Aand so ones...
Using JAVA with Scriptol
The Scriptol compiler produces a binary executable, easy to install,
unlike Java classes in bytecode...
Nothing to install but the executable and its files. Of cource, the
Java runtime is required!
import java.lang.System
import java JavaDemo
System infos ` instance of the java.lang.System class
JavaDemo demo ` instance of the JavaDemo class
demo.myVar = infos.getProperty("java.version")
print "Java version", demo.getVar()
demo.setVar(infos.getProperty("os.name") + " " + infos.getProperty("os.version"))
print "OS", demo.myVar
demo.exit(0)
The JavaDemo class
public class JavaDemo
{
public String myVar;
// Assign a value to a variable
public void setVar(String str)
{
myVar = str;
}
// Return the value of a variable
public String getVar()
{
return myVar;
}
}
Update:
From version 5, the PHP interpreter does not support Java. It still works in the Scriptol C++ version.