• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: running a perl script with RunTime.Exec causes perl script to die
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: running a perl script with RunTime.Exec causes perl script to die


  • Subject: Re: running a perl script with RunTime.Exec causes perl script to die
  • From: Patrick Middleton <email@hidden>
  • Date: Wed, 8 Nov 2006 11:18:35 +0000


On 7 Nov 2006, at 23:46, Johan Henselmans wrote:

I have produced a perl script to do some printing and database housekeeping, which is called using Runtime.Exec.

The script connects to a postgresql database, selects a parent- record via an argument and then prints some information from the children records.

When I run this script from a shell, it runs fine.

However, when I call the script from the webobjects application, I get an error message:
...
The java code that calls the script is:
****************************************

	commands[0] = "/usr/bin/perl";
	commands[1] = "/usr/local/bin/printorder.pl";
	commands[2] = " --ordernr";
	commands[3] = order.orderid().toString();

vars[0] = "PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/ bin";
vars[1] = "LD_LIBRARY_PATH=$LD_LIBRARY_PATH";


...
********************************************************
Is there anybody that has experienced something similar and has come up with a solution?

You are setting the perl script's environment variables in a way that doesn't work.
If you run the perl script from a shell, the interpreter inherits a suitable environment.
If run from java.lang.Runtime, LD_LIBRARY_PATH will be set to '$LD_LIBRARY_PATH'. The dollar expansion is something done for you by the shell; but there is no shell, so no substitution is done. Rewrite your code to initialize vars[0] and vars[1] using explicit values, perhaps obtained via java.lang.System.getenv().


--
Patrick Middleton
OneStep Solutions plc
351 London Road             Phone: +44 (0)1702 426400
Hadleigh                    Fax:   +44 (0)1702 556855
Essex. SS7 2BT              Email: email@hidden
England                            (MIME welcome)

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: running a perl script with RunTime.Exec causes perl script to die
      • From: Johan Henselmans <email@hidden>
References: 
 >running a perl script with RunTime.Exec causes perl script to die (From: Johan Henselmans <email@hidden>)

  • Prev by Date: WebPdfReports and Header
  • Next by Date: Re: WebPdfReports and Header
  • Previous by thread: Re: running a perl script with RunTime.Exec causes perl script to die
  • Next by thread: Re: running a perl script with RunTime.Exec causes perl script to die
  • Index(es):
    • Date
    • Thread