Register a domain and help support LQ
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-19-2004, 05:21 AM   #1
LQ Newbie
Registered: Apr 2004
Posts: 2

Rep: Reputation: 0
Question Perl exec function in linux (and system-function)

Can anyone tell me whats wrong in my code???

I'll try generate image with java, it works fine but I can't call that sub-program from perl... that is web-based script, so it have to call from cgi-script. If I run that script on shell, it works fine but when its called from web-page it wont work!

system("java", "-Djava.awt.headless=true DrawPie '40-50' 11 '50-60' 12 '20-24' 1 'Others' 10");
That doesn't do anything... no any errors, but not even execute my sub-program... I'll try it with exec-command too, but it makes exception... and doesn't exec java-command...

exec("java -Djava.awt.headless=true DrawPie '40-50' 11 '50-60' 12 '20-24' 1 'Others' 10");
I think that needs to call from shell, but how i can call java in shell from web-page???

thanks -m-
Old 04-19-2004, 12:21 PM   #2
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 42
I'll bet that the java executable is not in your PATH when running under the webserver. Give a full path to java in your calls.

I'm also betting that you're not checking the return value of system(). If it returns false, it failed. You can also use $? to get the error status of the command run by system: see perldoc -f system


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
perl: can I make the system function timeout? apeekaboo Programming 7 07-24-2007 07:52 AM
exec function in Linux programming geminigal Programming 5 05-06-2005 04:07 AM
Help php exec, system function for compile javac or java antony_csf Programming 0 06-15-2004 01:45 AM
what are the Hexadecimal function and ASCII function in Perl Bassam Programming 1 06-03-2004 01:44 AM
Perl system function syntax Crashed_Again Programming 2 03-20-2004 04:00 AM

All times are GMT -5. The time now is 11:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration