You are here: FME Server Developer's Guide > Developing with the Core APIs > Java > Java Quick Start

Java Quick Start

Setting Up a Java Project Using Eclipse

  1. Start Eclipse.
  2. Choose File > New > Project and select Java Project.
  3. Enter FMEServerAPIDemo for the project name.
  4. In the Java Settings dialog under the Libraries tab, click on Add External JARs button and select all the JARs in the <FMEServerDir>\Server\sdk\java folder to add to your project.
  5. Now add a Java Class file and import the FME Server Java API namespace. This for example can be done with the following line of code:
  6. import COM.safe.fmeserver.api.*;

Running the API Sample demo...

A sample command-line demo application illustrating the use of the FME Server API is available in C++, .Net, and Java versions.

This demo can be used to ensure that everything has been setup properly, and contains code that may be useful for your development process. (More in-depth coverage can be found in the later sections.)

If security is enabled for FME Server, your application must provide a client ID that has been registered with FME Server. The client ID for the demo application is app_apidemo. By default, the demo's client ID is not registered with FME Server, and you must register the client ID. (See Resources for more information.)

The command-line application requires two parameters: the FME Server host and FME Server port.

Note:  <fmeServerHost> represents the name of the host on which the FME Server is running.

<fmeServerPort> represents the TCP/IP port number the FME Server is listening on for requests. The default value is 7071 and this is usually correct for most FME Server installations.

The Java source code was developed using Java JDK V1.5 and is located in:

<FMEServerDir>\Server\sdk\samples\apidemo\java\FMEServerAPIDemo.java

...using the new project from the previous section

Add the source code to your project, and run.

...independently or with another IDE

To compile:

<jdkInstallDir>\bin\javac.exe FMEServerAPIDemo.java

To run:

<jdkInstallDir>\bin\java.exe -cp .;..\..\..\Java\fmeserverapi.jar;..\..\..\Java\jaxen-1.1.1.jar;..\..\..\Java\dom4j-1.6.1.jar FMEServerAPIDemo <fmeServerHost> <fmeServerPort>

Safe Software Inc. www.safe.com