wood burning stoves 2.0
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
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File Search" Watch "File Search" New topic

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??
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.

File = FindFile.get("perl.exe");
the return is File() or null.
Works fine.
Consider Paul's rocket mass heater.
subject: File Search
It's not a secret anymore!