Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » how to find my external programs?
how to find my external programs? [message #127980] Fri, 12 September 2003 03:26 Go to next message
Eclipse UserFriend
Originally posted by: ian.brown.printsoft.de

I am investigating what I need to do to ship a product based on eclipse.
My plug-in needs to call some c++ executables, and these will be shipped
with the product. The directory structure I have at the moment is like this:

<install directory>
/bin
/jre
eclipse.exe
/features
etc.

It's not quite as the documentation suggests (i.e. there is no eclipse
sub-directory) ... this is because I am using the free zero-g installer and
it insists on putting the jre in the install directory.
Anyhow, my tools live in the bin directory. At the moment, I just make sure
that <install directory>/bin is on the path and invoke them by name. Because
I want to support side by side installations, I need to change my plug-in so
that it invokes my executables directly ... i.e. the system command needs to
be:
<install directory>/bin/mytool.exe

The question I have is how do I find <install directory> from within
eclipse. I can find the directory for the workspace, for the project and
even for the directory passed along with the -data command line option ...
but none of these are what I need. I need the location of the currently
running eclipse.

Anyone any ideas or pointers,

Ian
Re: how to find my external programs? [message #129852 is a reply to message #127980] Mon, 15 September 2003 18:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

Platform.resolve(BootLoader.getInstallURL())
--

Ian Brown wrote:
> The question I have is how do I find <install directory> from within
> eclipse. I can find the directory for the workspace, for the project and
> even for the directory passed along with the -data command line option ...
> but none of these are what I need. I need the location of the currently
> running eclipse.
Re: how to find my external programs? [message #130013 is a reply to message #129852] Tue, 16 September 2003 05:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ian.brown.printsoft.de

My problem with the URL approach was that I couldn't figure out how to
convert a URL to a Path (I'm a c++ man really, java is still a bit of a
black art). Anyhow, I sort of got what I wanted with the following code ...
the problem being that when I debug, my plug-in directory does not really
exist. Still, it works for production code.

Runtime runtime = Runtime.getRuntime();
IPath platform_path = Platform.getLocation();
platform_path = platform_path.append("bin");
platform_path = platform_path.append("PDSCompiler");
String[] cmd_array = new String[2];
cmd_array[0] = platform_path.toOSString();
cmd_array[1] = source_path.toOSString();
try {
Process p = runtime.exec(cmd_array);
....


"John Arthorne" <John_Arthorne@oti.com_> wrote in message
news:3F664468.3070107@oti.com_...
> Platform.resolve(BootLoader.getInstallURL())
> --
Re: how to find my external programs? [message #130401 is a reply to message #130013] Tue, 16 September 2003 16:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

Platform.getLocation() returns the user's content area (the "workspace"
directory). BootLoader.getInstallURL() returns the eclipse install
directory. You can convert from URL to file using URL.getFile().

By the way, you can chain IPath methods to make your code less verbose.
The snippet below could be rewritten as:

IPath platform_path = Platform.getLocation().append("bin/PDSCompiler");
String[] cmd_array = new String[2];
cmd_array[0] = platform_path.toOSString();
....


Ian Brown wrote:
> My problem with the URL approach was that I couldn't figure out how to
> convert a URL to a Path (I'm a c++ man really, java is still a bit of a
> black art). Anyhow, I sort of got what I wanted with the following code ...
> the problem being that when I debug, my plug-in directory does not really
> exist. Still, it works for production code.
>
> Runtime runtime = Runtime.getRuntime();
> IPath platform_path = Platform.getLocation();
> platform_path = platform_path.append("bin");
> platform_path = platform_path.append("PDSCompiler");
> String[] cmd_array = new String[2];
> cmd_array[0] = platform_path.toOSString();
> cmd_array[1] = source_path.toOSString();
> try {
> Process p = runtime.exec(cmd_array);
> ...
>
>
> "John Arthorne" <John_Arthorne@oti.com_> wrote in message
> news:3F664468.3070107@oti.com_...
>
>>Platform.resolve(BootLoader.getInstallURL())
>>--
>
>
>
Re: how to find my external programs? [message #132871 is a reply to message #130401] Fri, 19 September 2003 04:19 Go to previous message
Eclipse UserFriend
Originally posted by: ian.brown.printsoft.de

Very helpful. Once again, thankyou!
Ian
Previous Topic:Help!!!
Next Topic:Quick help view
Goto Forum:
  


Current Time: Mon Jul 14 15:49:57 EDT 2025

Powered by FUDForum. Page generated in 0.08125 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top