Revision [1589]
This is an old revision of FunctionJnew made by DavidLee on 2010-11-20 06:38:19.
Function jnew
This function is part of the Java Objects support.
Name
jnew creates a Java ObjectSynopsis
jnew( classname [args ...] )Description
jnew creates an instance of a java object given its classname and optional constructor arguments.
The classname must be either in one of the packages in the global CLASSPATH or an imported class.
If no additional arguments are provided then the default constructor for the class is used.
Otherwise a constructor matching the types of the supplied arguments is searched for and if found, invoked.
The result is the newly created java object.
Typical use would be to assign this object to a variable or to pass to a function or command.
Example: Create a java.util.Date object and print the unix time.
date=jnew(java.util.Date) echo date.getTime()
Result
1290261981094
Throws an exception if the class is not found or cannot be constructed.
Commands
Functions
Java Objects