[ Prev | Index | Next ]
Japanese English

Step 5 - Implement Functions/Variables in Java®
(Plug-in Development)

You can implement new built-in variables and function in the Java® programming language. On the RINPn and the Vnano, we refer a Java® program to provide built-in functions/variables as "plug-in".

In this way, compared to defining variables/functions as script code (in the step-4), high-functionality of Java® might be the great merit.

On the other hand, it requres Java® Development Kit (JDK) to compile implemented code. Here we assume that JDK(s) is installed in your PC and "javac" command is available on it. For details of how to install a JDK, as an example, search on the web with keywords "OpenJDK   install   (name of your OS)" and so on.

How to Use Plug-Ins

For using on the RINPn, plug-ins should be put in the "plugin" folder of the RINPn. In the folder, a simple example of a plug-in "ExamplePlugin.java" exists:

(The content of "ExamplePlugin.java" in "plugin" folder)

public class ExamplePlugin {

    public double pivar = 1.0;

    public double pifun(double arg) {
        return arg * 2.0;
    }
}

This plug-in is compiled by default, and is set to be loaded (how we set it will be explained later).

The field "pivar" and the method "pifun(arg)" are available as a built-in variable/function inputted to the calculator (see Step-1 and Step-2), and in the script code (see step-3 and Step-4).

For example:

INPUT:
1 + pivar

OUTPUT:
2

INPUT:
pifun(2)

OUTPUT:
4

How to Compile Plug-ins

When you modify code of the plug-in, it requires to be re-compiled as follows:

cd (folder of the RINPn)
javac ExamplePlugin.vnano

By the way, some compiled class files of special plug-in-interfaces (XFCI1, XNCI1, and so on) supported by the Vnano Engine are bundled in the "plugin/org/vcssl/connect" folder. If you want, you can import them from your plug-in (see "Plugin Development" section in the document of the Vnano) and you can compile it in the same way as the above example.

How to Add New Plug-ins

If you want to add a new plug-in, put it in the "plugin" folder and compile it. Then, describe (append) the path of the compiled class file into the content of the text file "VnanoPluginList.txt" in "plugin" folder. All plug-ins specified in "VnanoPluginList.txt" will be loaded by the RINPn.

Vnano Standard Plug-ins

In "plugin/org/vcssl/nano/plugin" folder, "Vnano Standard Plug-ins" which provide basic features (math functions, utility functions, and so on) are bundled. They will be loaded by default (specified in "VnanoPluginList.txt"), so you can use their functions/variables by default.

For browsing the full list and detailed specification documents of Vnano Standard Plug-ins, see "Vnano Standard Plug-ins" page in the official website of the Vnano.

Also, frequently-used functions/variables on the RINPn and simplified explanations of them are listed in the page: Appendix - List of Built-in Functions/Variables.

- Trademarks/Credits -
  • Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  • Microsoft Windows is either a registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
  • Linux is a trademark of linus torvalds in the United States and/or other countries.
  • Other names may be either a registered trademarks or trademarks of their respective owners.


Sponsored Link



Japanese English
Index of this category
Announcementi Twitter j