Scilab 6.0.1
      
      - Справка Scilab
 - Java из Scilab
 - Getting started - Beginning
 - Getting started - Second step
 - jallowClassReloading
 - jarray
 - jautoTranspose
 - jautoUnwrap
 - jcast
 - jcompile
 - jcreatejar
 - jdeff
 - jdisableTrace
 - jenableTrace
 - jexists
 - jgetclassname
 - jgetfield
 - jgetfields
 - jgetinfo
 - jgetmethods
 - jimport
 - jinvoke
 - jinvoke_db
 - jnewInstance
 - jnull
 - jremove
 - jsetfield
 - junwrap
 - junwraprem
 - jvoid
 - jwrap
 - jwrapinchar
 - jwrapinfloat
 - new
 
Please note that the recommended version of Scilab is 2026.0.0. This page might be outdated.
See the recommended documentation of this function
jinvoke
Invoke a method of a Java object
Syntax
ret = jinvoke(object, methodName [, arg_1 [, arg_2...]])
Parameters
- object
 A mlist typed _JObj or _JClass or a Scilab variable
- methodName
 A string giving the method name
- arg_i
 A Scilab variable as method argument
Description
Invoke the Java method (static or not) called methodName of the given object. The result is returned as a mlist typed _JObj.
The polymorphism is handled in using Java Reflection and the autoboxing is handled too so ArrayList.add(1.234) or ArrayList.add("Hello") are allowed. If it exists a method Foo.bar(int), it is possible to write Foo.bar(123) even if 123 is a Scilab double but Foo.bar(double), if it exists, will be chosen.
Examples
jimport java.lang.System; jimport java.awt.Color; jimport java.lang.String; // Non-static methods jinvoke("Hello World !!", "length"); str = String.new("Hello"); jinvoke(str,"substring",1, 4) // Static method T = jinvoke(System, "getProperty", "java.version"); // Combine c = jinvoke(Color, "decode", "123456"); cb = jinvoke(c, "brighter"); jcode = jinvoke(cb, "getRGB"); jremove System Color T c cb jcode;
See also
- jautoUnwrap — Unwrap automatically returned values
 - jinvoke_db — Invoke a method of a Java object in using Java direct buffers
 
History
| Version | Description | 
| 5.5.0 | Function introduced. Based on the 'JIMS' module. The main difference in the behavior compared to the JIMS module is that jautoUnwrap is enabled by default. | 
| Report an issue | ||
| << jimport | Java из Scilab | jinvoke_db >> |