Building and Running a Java OpenMaple Application - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : OpenMaple : Java Application Programming Interface : OpenMaple/Java/running

Building and Running a Java OpenMaple Application

 

Packages

Building

Running

Packages

• 

The Java OpenMaple classes are provided in the com.maplesoft.openmaple package.  This package is contained within the Maple.jar file. A second package, com.maplesoft.externalcall.MapleException is also required for Java OpenMaple.  This class is in the externalcall.jar file. For documentation on the contents of the com.maplesoft.openmaple package, see OpenMaple/Java/API.  For information about com.maplesoft.externalcall.MapleException, see ExternalCalling/Java/MapleException.

• 

These jar files are in the java directory of your Maple installation.  The directory that Maple is installed in can be found by calling kernelopts( mapledir ).

kernelopts( mapledir );

C:\Program Files\Maple 2015

(1)

In the following sections we will refer to this directory as <MAPLEDIR>.  Different platforms and installation locations will effect this directory, so you should call kernelopts( mapledir ) to determine the correct location on your machine.

Building

• 

To build a Java OpenMaple application the two required jar files, Maple.jar and externalcall.jar, must be in the classpath. Simply specify these files in a command-line argument to the Java compiler. In general, the -classpath argument should work.  You will need to have write permissions for the current directory as this command will create a new file.

Windows

javac -classpath "<MAPLEDIR>\java\externalcall.jar;<MAPLEDIR>\java\Maple.jar" app.java

Apple OS X and Linux

javac -classpath "<MAPLEDIR>/java/externalcall.jar:<MAPLEDIR>/java/Maple.jar" app.java

Running

• 

Running a Java OpenMaple application requires loading a native library. This native library provides the link between Maple and Java.  The Java Virtual Machine automatically loads the required library; however, it needs to be told where to find this library.  By default, the native library is installed in the Maple binary directory.  To determine this location, call kernelopts( bindir ).

kernelopts( bindir );

C:\Program Files\Maple 2015\bin.win

(2)

Different platforms and installation locations will effect the directory you need to use, so you should call kernelopts( bindir ) to determine the correct location.  We will refer to this directory as <BINDIR> in the following examples.  

• 

To tell the Java Virtual Machine to look in this directory, you need to add <BINDIR> to a platform specific environment variable.  In addition on Apple OS X and Linux, the MAPLE environment variable needs to be set to the value <MAPLEDIR> we defined above.

Windows

• 

In Windows, you need to add <BINDIR> to the PATH environment variable

set PATH=%PATH%;<BINDIR>

Linux

• 

On Linux, you need to add <BINDIR> to the LD_LIBRARY_PATH environment variable and set the MAPLE environment variable.

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:<BINDIR>"

export MAPLE="<MAPLEDIR>"

Apple OS X

• 

On Apple OS X, you need to add <BINDIR> to the DYLD_LIBRARY_PATH environment variable and set the MAPLE environment variable.

export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:<BINDIR>"

export MAPLE="<MAPLEDIR>"

• 

As with the compiler, the Java Virtual Machine must have the Maple.jar and externalcall.jar files added to the classpath, along with the directory containing the test.class file created above. Once again, using the -classpath command-line argument is recommended. This example assumes that the test.class file is stored in the current directory.

Windows

java -classpath "<MAPLEDIR>\java\externalcall.jar;<MAPLEDIR>\java\Maple.jar;." test

Apple OS X and Linux

java -classpath "<MAPLEDIR>/java/externalcall.jar:<MAPLEDIR>/java/Maple.jar:." test

• 

Before beginning development of a Java OpenMaple application, ensure that the simple example from the examples page can be built and executed.  Once this works, a more complex Java OpenMaple application can be built the same way.

See Also

OpenMaple

OpenMaple/Java/API

OpenMaple/Java/Engine

OpenMaple/Java/Examples

trademark

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam