Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Search

 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Yaroslav Chinskiy
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic