Import a Java class
jimport(className) cl = jimport(className, isAClassReturned)
A string giving the class name
A boolean to indicate if a class object must be returned
The class must be in the classpath (to add a package or a directory in the Java classpath, just use javaclasspath).
When jimport("java.lang.String")
, a mlist named String is created on the Scilab stack. The created mlist has a type equals to _JClass and can be used to instantiate new objects in using something like str = String.new("A Scilab String");
. It is possible to call the static methods (if exist) of the class
jimport java.lang.System; jimport java.util.Date; System.err.println("A message print in the Scilab console"); l = System.currentTimeMillis(); d = Date.new(l) jremove(l,d); | ![]() | ![]() |
To avoid confusion with already existing Scilab variables, the second argument isAClassReturned can be used
A class can be reloaded if it is allowed by the function jallowReloadClass
.