Skip to content

Latest commit

 

History

History
58 lines (33 loc) · 1.73 KB

first_application_eclipse.md

File metadata and controls

58 lines (33 loc) · 1.73 KB

Your first jSpace applications (with Eclipse)

If you have successfully built and installed you can use Eclipse to develop your first jSpace Application. In fact you will use Eclipse as an IDE and Maven to manage dependencies.

Open Eclipse and select File->New->Project menu:

Spaces, repositories and gates

Select Maven->Maven Project:

Spaces, repositories and gates

Leave the default parameters and click Next:

Spaces, repositories and gates

The skeleton of a Maven project is generated. Open pom.xml file to add the dependency to jSpace:

Spaces, repositories and gates

Select the tab Dependencies:

Spaces, repositories and gates

Press button Add to include the reference to jSpace. This opena dialog that you can fill as follow:

Spaces, repositories and gates

You can now open the file App.java to code your first jSpace App:

Spaces, repositories and gates

Add the following code:

package com.mycompany.myjspaceapp;

import org.jspace.FormalField;
import org.jspace.SequentialSpace;
import org.jspace.Space;

public class App {

	public static void main(String[] argv) throws InterruptedException {
		Space inbox = new SequentialSpace();

		inbox.put("Hello World!");
		Object[] tuple = inbox.get(new FormalField(String.class));				
		System.out.println(tuple[0]);

	}

}

At this point you can exectute your application:

Spaces, repositories and gates