Tricks of the Trade
In and Out
Download This Issue
Mathematica 4.2: A Technical Review
Mathematica 4.2 shipped with a new release of J/Link, the toolkit that integrates Mathematica and has Java pre-installed, thereby avoiding the installation step for all platforms. Using J/Link, you can call Java from Mathematica in a completely transparent way and also control the Mathematica kernel from any Java program.
For Mathematica users, J/Link makes the whole universe of existing and future Java classes an automatic extension to the Mathematica environment. For example, users can use standard Java classes to provide new interfaces to Mathematica or create graphical user interface (GUI) elements using Abstract Window Toolkit (AWT) or Swing classes.
For Java programmers, J/Link turns Mathematica into a scripting shell that allows them to experiment with, build, and test Java classes one line at a time. It also makes Java a powerful language for writing programs that use the computational services of Mathematica.
Mathematica 4.2 includes J/Link and JRE Version 1.4 on Windows, Linux, and Solaris and the JRE Version 1.3.1 on most other platforms. This means that you can start using J/Link right out of the box. Mathematica developers can now also rely on a JRE for applications that mix Mathematica and Java functionality. Let us look at a simple example.
This loads the J/Link package.
This launches the Java runtime and prepares it for use.
This constructs a new object of the specified class.
Functions in this Java class can then be called from Mathematica.
J/Link 2.0 has a number of enhancements over previous versions of J/Link, including the following.
See the article by Todd Gayley in this issue for information on building user interfaces using J/Link. Additional examples and information about J/Link are available on the Wolfram Research website at www.wolfram.com/solutions/mathlink/jlink.
About Mathematica Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.