Setting up your IDE
Follow the instructions in this tutorial to prepare your development environment.
Ensure you have a JDK installed. You will need Java 8 or higher, latest update is recommended.
Checking your JDK Version
To check your installed Java version:
- Open a command line window.
A response similar to this suggests you have a JDK installed:
To check the JDK version, run
%JAVA_HOME%\bin\java \-version. A response like this from
Javaindicates you have a valid JDK installed:
java version "1.6.0_23" Java(TM) SE Runtime Environment (build 1.6.0_23-b05) Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
If your installed JDK version is lower then 1.5 or none is installed, see below on how to install one.
Installing a Proper JDK (Java Development Kit)
- To install JDK 1.6, download and install JDK 6 Update X
- Download and unzip the latest XAP release from the downloads page.
- Install a Java IDE. If you don’t have an IDE installed, you can download and unzip the Eclipse IDE for Java Developers, or the IntelliJ IDEA IDE (we recommend the Ultimate Edition because of its excellent Spring framework support). If you’re using Eclipse, it is also recommended to install the Spring Tool Suite plugin for Eclipse.
Running the Application inside Eclipse IDE
- Start Eclipse. The Workspace Launcher window opens.
- Write a new workspace name or select one of your existing workspaces, and click OK.
- To import the project, select File > Import to open the Import window.
- Select Existing projects into workspace and click Next to open the Import Project window.
- In the Select root directory field, click Browse to open the browse window.
- Select the folder
/examples/helloworldand click OK.
- Make sure the following 3 projects are selected: hello-common, hello-processor, and hello-feeder.
- Click Finish.
- Create a new Eclipse environment variable called GS_HOME, and point it to your GigaSpaces installation Root folder.
- Right click the hello-common project in the Package Explorer tab to open the context menu.
- Select Build Path > Configure Build Path to open the Java Build Path window.
- Select the Libraries tab* and click the *Add Variable… button to open the New Variable Classpath Entry dialog
- Click Configure Variables to open the Classpath Variables window.
- Click New to open the New Variable Entry window.
- In the Name field, write
GS_HOMEto name the variable.
- Click Folder and browse to your GigaSpaces installation root folder.
- Select your GigaSpaces installation root folder and click OK (3 times in total).
- Click Yes to do a full rebuild.
- Close the remaining windows.
The XAP libraries are located under
XAP_HOME/lib. There are three sub-directories:
lib/required- JAR files that are required for any GigaSpaces application.
lib/optional- JAR files that enable additional capabilities, such as servlet api.
lib/platform- JAR files that are used only by the XAP platform.
In order to compile and run XAP applications, all the JAR files under the
XAP_HOME/lib/required directory should be included in your compile and run time classpaths. Additional JAR files that you may need for development are located at
Runtime - Processing Unit
When an application is deployed as a Processing Unit, there is no need to add XAP-specific JAR files to the Processing Unit classpath. If such are added under the Processing Unit’s
lib directory, the system will remove those JAR files and replace them with the system’s JARs for compatibility.
Runtime - Standalone
When running a standalone client that accesses XAP, ensure that all the JARs located under the
XAP_HOME/lib/required directory are part of the JVM’s classpath. This also holds true for remote Space clients that are used from another JVM (such as a standalone web container). If your client is a JEE web application that is not running within the XAP runtime environment, or more specifically a GSC, you must include these JARs in your application’s
XAP is Maven-friendly. It is built using Maven, which can be easily used by developers constructing XAP applications.
The main dependency required to use XAP is
<dependency> <groupId>org.gigaspaces</groupId> <artifactId>xap-openspaces</artifactId> <version>12.3.1</version> </dependency>
XAP artifacts are currently not published in Maven Central Repo, therefore you must configure a repository:
<repository> <id>org.openspaces</id> <url>http://maven-repository.openspaces.org</url> </repository>