Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Calling perl program from Java

Thread view: 
miki.rao@gmail.com - 17 May 2006 18:58 GMT
Environment is Linux.
I have a perl script which needs to be executed from within a Java
Program.

Works fine on windows environment.

String cmd = "perl "+PropertyManager.getProperty("PerlScript")+" "
+inputFile +" "+ outfile

Any hints would be great.

Mekhala
bmcdougald@hotmail.com - 17 May 2006 19:19 GMT
Does the user profile that the java program is executing under have
knowledge of where the perl interpreter is?  In other words, is perl in
the path.

What if you put your command in a shell script along with the perl
evironmental vars and execute the shell script.  Just make sure the
script has execute authority.
Fred Kleinschmidt - 17 May 2006 19:31 GMT
> Environment is Linux.
> I have a perl script which needs to be executed from within a Java
[quoted text clipped - 8 lines]
>
> Mekhala

What doesn't work about it? How can we help if you don't say what's wrong?
"It doesn't work" could mean almost anything. Does perl exist on your Linux
platform?
Does java? Is the machine turned on?
Signature

Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project

Dražen Gemić - 17 May 2006 23:58 GMT
>>Environment is Linux.
>>I have a perl script which needs to be executed from within a Java
[quoted text clipped - 4 lines]
>>String cmd = "perl "+PropertyManager.getProperty("PerlScript")+" "
>>+inputFile +" "+ outfile

I don't know what is "PropertyManager", but as long as it returns
a valid name of the "PerlScript", and Perl is in PATH, it should
work everywhere.

Hint: don't expect '\\' separator to work on anything but Windows.

DG
Scott Ellsworth - 19 May 2006 00:28 GMT
> >>Environment is Linux.
> >>I have a perl script which needs to be executed from within a Java
[quoted text clipped - 10 lines]
>
> Hint: don't expect '\\' separator to work on anything but Windows

And Hint The Second: always use the String[] form of exec, as it is not
confused by spaces in file names.

Scott

Signature

Scott Ellsworth
scott@alodar.nospam.com
Java and database consulting for the life sciences

Jeffrey Schwab - 18 May 2006 02:45 GMT
> Environment is Linux.
> I have a perl script which needs to be executed from within a Java
[quoted text clipped - 8 lines]
>
> Mekhala

Congratulations, sounds like things are going just fine.  Post again if
you have any trouble.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.