Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
Building and Running a Java OpenMaple Application
Packages
The Java OpenMaple classes are provided in the com.maplesoft.openmaple package. This package is contained within the jopenmaple.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 );
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, jopenmaple.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\jopenmaple.jar" app.java
Apple OS X, Linux and Solaris
javac -classpath "<MAPLEDIR>/java/externalcall.jar:<MAPLEDIR>/java/jopenmaple.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 );
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, Linux and Solaris, the MAPLE environment variable needs to be set to the value <MAPLEDIR> we defined above.
In Windows, you need to add <BINDIR> to the PATH environment variable
set PATH=%PATH%;<BINDIR>
Linux and Solaris
On Linux and Solaris, 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>"
As with the compiler, the Java Virtual Machine must have the jopenmaple.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.
java -classpath "<MAPLEDIR>\java\externalcall.jar;<MAPLEDIR>\java\jopenmaple.jar;." test
java -classpath "<MAPLEDIR>/java/externalcall.jar:<MAPLEDIR>/java/jopenmaple.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