Connecting java with constraint logic programming

178 Views Asked by At

i'm trying to connect java with constraint logic, i'm using netbeans for java and eclipse 6.1 for constraint logic, but when i'm trying to run the code there is an exception appears java.lang.IllegalArgumentException: Missing eclipse.directory property

i've used a tutorial that explain how to connect them, which says that 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_directory>

and i don't know where to place it in netbeans

here is the code

import com.parctechnologies.eclipse.*;
import java.io.*;
public class eclipseConnection {    
    public static void main(String[] args) throws Exception
  {
      try{

    EclipseEngineOptions eclipseEngineOptions = new EclipseEngineOptions();
    EclipseEngine eclipse;
    eclipseEngineOptions.setUseQueues(false);
    eclipse = EmbeddedEclipse.getInstance(eclipseEngineOptions);
    eclipse.rpc("write(output, 'hello world'), flush(output)");
    ((EmbeddedEclipse) eclipse).destroy();
  }catch(Exception e){
      System.out.println(e);
  }
  }
}
2

There are 2 best solutions below

5
On BEST ANSWER

You can add the property definition in the 'Run' menu: Run > Set Project Configuration > Customize.... Make sure you enter the property definition -Declipse.directory=<eclipse_directory> in the VM Options section.

1
On

Let's use the command line and the example source file Quicktest.java.

Copy the example:

copy "C:\Program Files\ECLiPSe 6.1\doc\examples\JavaInterface\Quicktest.java" .

Compile it:

javac -classpath "C:\Program Files\ECLiPSe 6.1\lib\eclipse.jar" QuickTest.java

Run it:

java -classpath ".;C:\Program Files\ECLiPSe 6.1\lib\eclipse.jar" -Declipse.directory="C:\Program Files\ECLiPSe 6.1" QuickTest
hello world