Re: Java to eclipse

From: Pascal Nicolas <pn_at_info.univ-angers.fr>
Date: Tue 27 Oct 1998 04:30:56 PM GMT
Message-ID: <Pine.LNX.3.95.981027170744.2631A-100000@vega.info.univ-angers.fr>
> ---------- Forwarded message ----------
> Date: Fri, 23 Oct 1998 17:18:56 +1000
> From: Dean Kuo <dean.kuo@act.cmis.CSIRO.AU>
> Reply-To: dean.kuo@cmis.csiro.au
> To: eclipse_users@ecrc.de
> Subject: Java to eclipse
> Resent-Date: Sat, 24 Oct 1998 23:14:56 +0200
> Resent-From: micha@ecrc.de
> Resent-To: "ECLiPSe Users Mailing List"<eclipse_users@ecrc.de>
> 
> Hi everyone,
> 
> Is it possible to invoke eclipse from JAVA without the need to 
> go via C? If it is, can someone point me in the right
> direction. 
> 

First, suppose you have the following Eclipse source file sample.pl

===================== sample.pl ===========================
:-open("sample.out",write,Stream),
  write(Stream,"Hello you. I'm running Eclipse !"),
  nl(Stream),
  close(Stream),
  halt.
===========================================================

and the following Java source file RunEclipse.java

======================= RunEclipse.java ===================
class RunEclipse{
  /*
    version     : jdk1.1.1 on Linux
    call syntax : java RunEclipse "command"
    effect      : execute the given command
   */
  
  public static void main(String arg[]) {
    Runtime R;
    R=java.lang.Runtime.getRuntime();
    try {
      R.exec(arg[0]);
    }
    catch (java.io.IOException E) {
      System.out.println(E);
    }
  }
}
===========================================================

You compile the java source file and obtain RunEclipse.class

Then, running 

    java RunEclipse "eclipse -b sample.pl"

executes the goal in sample.pl and produces the output file sample.out

Obviously, your java program can make a lot of things before and after the call
of Eclipse, but I think that the great lines are in these exemples. 
For further details in Java you have to look in class java.lang.Runtime 

Last thing : I have tried this example on Linux with jdk1.1.1 and Eclipse 3.5.2

Good luck :-)

Pascal NICOLAS      University of Angers - France
E Mail   : pascal.nicolas@univ-angers.fr
Web Page : http://www.info.univ-angers.fr/pub/pn/
Received on Wed Oct 28 11:11:36 1998

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:03 PM GMT GMT