my dog learned polymorphism*
The moose likes I/O and Streams and the fly likes File Search Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File Search" Watch "File Search" New topic
Author

File Search

Yaroslav Chinskiy
Ranch Hand

Joined: Jan 09, 2001
Posts: 147
I want to run perl script from my Java app.
But I want to dynamically locate the perl.exe, how can I do it??
thanks
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
You could pull it out of the registry. Using regedit, I can see the registry entry that points to perl.exe on my system, so if you could get into the registry getting the location of perl.exe would be easy.
I'm not sure how to access the registry from java. You might have to use JNI.


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Yaroslav Chinskiy
Ranch Hand

Joined: Jan 09, 2001
Posts: 147
Thnk you.
But I found work around.
The perl scripts are part of the bigger application. I have config file for it already. So I added PATH variable to it and created class that searches for a file with in the PATH.
PATH=c:/windows;f:/stuff;c:/Perl/

File = FindFile.get("perl.exe");
the return is File() or null.
Works fine.
Yarik.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File Search