Calling perl program from Java

M

miki.rao

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
 
B

bmcdougald

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

Fred Kleinschmidt

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

Guest

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
 
J

Jeffrey Schwab

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

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

Scott Ellsworth

DraÃen Gemiç said:
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

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

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top