I am setting up a RMI server, but I am running into a error I am not able to solve. I use Ubuntu with Eclipse and a Maven project.
I get the following error:
Error: Could not find or load main class dsb.bar.flowmeter.flowserver.FlowServer

To get RMI working properly you need to setup the codebase and a policy. You do that with adding the following vm commands to the run configuration in Eclipse:
-Djava.security.policy=server.policy dsb.bar.flowmeter.flowserver.FlowServer

The policy file contains:
Java Code:
grant codeBase "file:///home/norberhuis/workspace/DSB/flowmeter/flowserver/target/classes/" {
    permission java.security.AllPermission;
The class I am running is:
Java Code:
package dsb.bar.flowmeter.flowserver;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import dsb.bar.flowmeter.flowclient.IDisplayClient;

 * Server that FlowClients can observe using RMI.
 * @author norberhuis
public class FlowServer implements IDisplayServer {

	private ArrayList<IDisplayClient> observers;

	static final Logger LOG = LoggerFactory.getLogger(FlowServer.class);

	 * Instantiate the server.
	public FlowServer() {
		LOG.info("Starting FlowServer");
		observers = new ArrayList<IDisplayClient>();


	public void registerObserver(IDisplayClient observer) throws RemoteException {
		LOG.info("Observer added");

	public static void main(String[] args) {
		// A security manager is needed for RMI.
		if (System.getSecurityManager() == null) {
			System.setSecurityManager(new SecurityManager());

		FlowServer server = new FlowServer();
		try {
			IDisplayServer remote = (IDisplayServer) UnicastRemoteObject.exportObject(server, 0);
			String name = "DisplayServer";

			Registry registry = LocateRegistry.getRegistry();
			registry.rebind(name, remote);

		} catch (RemoteException e) {

Anybody got an idea what I am doing wrong? Thanks in advance.