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 2024.1.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Java from Scilab > jcompile


Compile Java code or file


class = jcompile(className, code);
class = jcompile(javaFiles);



A string giving the class name


A row or a column of strings containing the Java code.


Path to Java files.


A mlist typed _JClass


Compile Java source code and load the corresponding class. If the package tools.jar distributed with JDK is not in the classpath, the Eclipse Compiler for Java (ECJ) will be used.

If the argument is a file, jcompile will compile the Java code.

*.class files generated by the compilation are stored in the TMPDIR/JIMS/bin directory.


hw = jcompile("HelloWorld", ["public class HelloWorld {"
                             "public static String getHello() {"
                             "return ""Hello World !!"";"

hello = hw.getHello()

jremove hello hw
fd = mopen(TMPDIR+'/','wt');
mputl(["public class HelloWorld {"
                   "public static String getHello() {"
                   "return ""Hello World !!"";"

// Compile of all them
jcompile(ls(directory + "/*.java"))

See also

  • jimport — Import a Java class
  • jallowClassReloading — Allow the class reloading
  • jdeff — Map a static Java method onto a Scilab macro
  • javasci — Call Scilab engine from a Java application
  • javasci v2 — How to compile a Java application using Javasci v2
  • javaclasspath — set and get dynamic Java class path


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
<< jcast Java from Scilab jcreatejar >>

Copyright (c) 2022-2023 (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