Up Next

8.1  Getting Started

At the end of this section you will run the simple Java program QuickTest.java which uses ECLiPSe. First of all though you need to check that your Java SDK version is recent enough and that your classpath correctly set up.

8.1.1  Check your Java SDK version

Use of the Java-ECLiPSe Interface requires an installation of the Java SDK (Standard Developer’s Kit) version 1.2.2 or later. If your Java SDK installation is an earlier version than this or you do not have the Java SDK on your machine, the latest version can be downloaded from Sun Microsystems Inc. (http://www.sun.com).

8.1.2  Make the com.parctechnologies.eclipse package available in your class path

The Java-ECLiPSe Interface consists mainly of a Java package which is used as a library by the Java programs you will write. This package is included as a .jar file located within the ECLiPSe distribution at:

<eclipse_dir>/lib/eclipse.jar

You are free to copy eclipse.jar to a more convenient location. However, to compile or run any Java programs which use the package you must include the full path of eclipse.jar in your classpath. For more information on using the classpath, please consult your Java documentation.

8.1.3  Compile and run QuickTest.java

To test that everything is working as it should be, and to see a quick example of the Java-ECLiPSe Interface at work, try compiling and running the Java program QuickTest.java. This starts up an ECLiPSe from Java and tells it to write a message to stdout. The program can be found at

<eclipse_dir>/doc/examples/JavaInterface/QuickTest.java

After compilation, to run the program, start the Java interpreter as you normally would but before the name of the class, supply the command line option

-Declipse.directory=<eclipse_dir>

This tells Java where to find the ECLiPSe installation, so it can run ECLiPSe. You should use this command line options when running all other examples in this document. When you run QuickTest.java, you should get a single line of output: hello world. How QuickTest.java works is explained in Section 8.2.


Up Next