Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Java from Scilab > jnewInstance

jnewInstance

Creates a new instance of a Java class

Syntax

obj = jnewInstance(class [, arg_1 [, arg_2... ]])

Parameters

class

A mlist typed _JClass or a string containing the class name

arg_i

A Scilab data or a mlist typed _JObj

obj

A mlist typed _JObj

Description

Creates a new instance of a Java class obtained with jimport.

Examples

jimport java.io.File;
jimport java.lang.System;

a = System.getProperty("java.io.tmpdir");
s = jnewInstance(File, a);
s.exists() // true

str = jnewInstance("java.lang.String", "Hello");
b = str.substring(1, 4)

jremove Date System s str b a;

See also

  • new — Creates a new instance of a Java class
  • jimport — Import a Java class

History

VersionDescription
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
<< jinvoke_db Java from Scilab jnull >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:49:23 CET 2020