Running Perl in Eclispe Epic Cygwin

jli023 wrote on Fri Sep  5 06:02:31 MEST 2008:
I have one Perl script which works when executing it directly in Cygwin
window. 

It uses find to find a type of file in a directory and its subdirectories:

my @jarfiles = split(' ',`find $bin_location -name "*.jar"`);

But when run or debug it in Eclipse, it has error:
sh: find: No such file or directory. 

I have set the Perl interpreter in Eclipse->Window->Preferences->perl EPIC.


Do you have any idea?

Thanks in advance. 

Jing

jploski wrote on Fri Sep  5 19:07:22 MEST 2008:
It looks like your PATH is different in both cases and therefore find.exe
can't be located. You can specify PATH for a script in the launch configuration,
or you could change the global environment so that Eclipse uses the same
PATH as your Cygwin shell.
jli023 wrote on Sun Sep  7 23:59:33 MEST 2008:
Hello Jan, 

Thank for your reply. 

The Cygwin path is:

/usr/local/bin:
/usr/bin:
/bin:
/usr/X11R6/bin:
/usr/bin: 
C:/Program Files/MiKTeX 2.7/miktex/bin:
/cygdrive/c/WINDOWS/system32:
/cygdrive/c/WINDOWS:
/cygdrive/c/WINDOWS/System32/Wbem:
/cygdrive/c/Program Files/MIT/Kerberos/bin:
/cygdrive/c/Program Files/OpenAFS/Client/Program:
/cygdrive/c/Program Files/OpenAFS/Common:
/cygdrive/C/jdk/bin:
/cygdrive/c/jdk/jre/bin/client:
/usr/bin:
/cygdrive/c/Program Files/SSH Communications Security/SSH Secure Shell:
/cygdrive/c/Program Files/Microsoft SQL Server/80/Tools/Binn:
/cygdrive/c/Program Files/Microsoft SQL Server/90/Tools/binn:
/cygdrive/c/Program Files/Microsoft SQL Server/90/DTS/Binn:
/cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727:
/cygdrive/c/Programs Files/MiKTex 2.6/miktex/bin:
/cygdrive/c/Program Files/Ruby/bin:
/cygdrive/c/Program Files/QuickTime/QTSystem/:
/cygdrive/c/Program Files/Windows Imaging/: 
:
/usr/bin: 
C:/Program Files/Microsoft Visual Studio/Common/Tools/WinNT:
/cygdrive/c/Program Files/Microsoft Visual Studio/Common/MSDev98/Bin:
/cygdrive/c/Program Files/Microsoft Visual Studio/Common/Tools:
/cygdrive/c/Program Files/Microsoft Visual Studio/VC98/bin:
/usr/lib/lapack

The system variable is 
C:\cygwin\bin; C:\Program Files\MiKTeX 2.7\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\MIT\Kerberos\bin;C:\Program Files\OpenAFS\Client\Program;C:\Program
Files\OpenAFS\Common;C:\jdk\bin;C:\jdk\jre\bin\client;C:\cygwin\bin;C:\Program
Files\SSH Communications Security\SSH Secure Shell;C:\Program Files\Microsoft
SQL Server\80\Tools\Binn;C:\Program Files\Microsoft SQL Server\90\Tools\binn;C:\Program
Files\Microsoft SQL Server\90\DTS\Binn;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Programs
Files\MiKTex 2.6\miktex\bin;C:\Program Files\Ruby\bin;C:\Program Files\QuickTime\QTSystem\;C:\Program
Files\Windows Imaging\; 

There are  a lot of difference between the two paths. 

Could you please tell me which path in Cygwin PATH variable affect the find
command?

Thank you very much, 

Jing
jploski wrote on Mon Sep  8 18:59:59 MEST 2008:
Locate the find.exe file on your hard disk and add the directory which contains
it to path.
jli023 wrote on Mon Sep  8 23:31:55 MEST 2008:
Thanks for your reply. 

The find.exe is located in c:\cygwin\bin. I have added the path to the system
path. 

I searched the web, and could not find out any helpful documents about how
to run perl using Eclipse+EPIC+cygwin on windows. There are documents about
Eclipse+EPIC+ActivePerl on windows. 

The scripts I work on work fine on linux, and I tested it works find in
Cygwin. I really want to know how to run it in Eclipse+EPIC+cygwin as it
allows me to debug the perl scripts. 

Can you point me the right way to do it?

Thank you very much, 

Jing
jploski wrote on Tue Sep  9 19:28:09 MEST 2008:
In the run configuration dialog where you enter the project and script name,
there is also an "Environment" tab where you can add environment variables
for the script. I would try adding PATH to it with the value c:/cygwin/bin,
if that doesn't work, I'd also try PATH with a Cygwin-style path (i.e.,
/usr/bin).

I don't have Windows here so I can't experiment with Cygwin myself.
jli023 wrote on Wed Sep 10 04:30:42 MEST 2008:
The Run/Debug configurations for these perl script are in Perl Local, which
only have three tabs: configuration, arguments, and common. It does not
include the environment tab. 

Thank you any way. I will keep find out how to do it. After I have the answer,
I will post back to the forum. 

Thanks again, 

Jing
jli023 wrote on Thu Sep 11 00:49:27 MEST 2008:
According to the document:
http://www.perl.com/doc/manual/html/pod/perlrun.html, I added 

$ENV{PATH} = '/bin:/usr/bin';    # or whatever you need
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};

to the top of the script, it works in Eclipse+EPIC+cygwin. 

Thanks for all of your help. 

Jing

Note: The above is an archived snapshot of a forum thread. Use the original thread at sf.net to post comments.