Re: [eclipse-clp-users] Java error messages

From: Joachim Schimpf <jschimpf_at_...153...>
Date: Wed, 04 Mar 2009 12:39:04 +1100
Paul Davern wrote:
> Hello Gregory,
> 
> In my experience of using the Java interface you can get no more information 
> than "there was an error". However, the error usually indicates that ECLiPSe 
> is unhappy with the goal you sent it and tells you so; except as far as I am 
> aware the Java interface swallows the message.

If you use an EmmbeddedEclipse, you should see the error messages
(provided you don't set the UseQueues option):

import com.parctechnologies.eclipse.*;
import java.io.*;
public class ErrTest
{
   public static void main(String[] args) throws Exception
   {
     EclipseEngineOptions eclipseEngineOptions = new EclipseEngineOptions();
     EclipseEngine eclipse = EmbeddedEclipse.getInstance(eclipseEngineOptions);
     eclipse.rpc("no_such_predicate");
   }
}

% javac -classpath /home/jschimpf/Eclipse/6.0_65/lib/eclipse.jar ErrTest.java
% java -classpath /home/jschimpf/Eclipse/6.0_65/lib/eclipse.jar:. 
-Declipse.directory=/home/jschimpf/Eclipse/6.0_65 ErrTest
calling an undefined procedure no_such_predicate in module eclipse  <<<<HERE
Exception in thread "main" com.parctechnologies.eclipse.Throw



In OutOfProcessEclipse, some flushing was missing.  I have fixed this
just now, but you can work around the problem by adding the line
eclipse.rpc("set_stream_property(error,flush,end_of_line)");
immediately after initialising your eclipse:

import com.parctechnologies.eclipse.*;
import java.io.*;
public class ErrTest
{
   public static void main(String[] args) throws Exception
   {
     EclipseEngineOptions eclipseEngineOptions = new EclipseEngineOptions();
     OutOfProcessEclipse eclipse = new OutOfProcessEclipse(eclipseEngineOptions);
     eclipse.rpc("set_stream_property(error,flush,end_of_line)");
     eclipse.rpc("no_such_predicate");
   }
}

% javac -classpath /home/jschimpf/Eclipse/6.0_65/lib/eclipse.jar ErrTest.java
% java -classpath /home/jschimpf/Eclipse/6.0_65/lib/eclipse.jar:. 
-Declipse.directory=/home/jschimpf/Eclipse/6.0_65 ErrTest
calling an undefined procedure no_such_predicate in module eclipse   <<<<HERE
Exception in thread "main" com.parctechnologies.eclipse.Throw


-- Joachim
Received on Wed Mar 04 2009 - 01:43:10 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST