| | |
Executing Shell script from Java code.
![]() |
•
•
Join Date: Apr 2007
Posts: 126
Reputation:
Solved Threads: 6
Hi all,
I would like to execute a shell script from my java code. Can some one please tell me if that is possible? Here's what I tried, but with no result.
In this program, I try to run the "./test.sh" shell script, which-for now-I have, just (echo "Hellow World"). But it doesn't seem that the script runs from within my code.
Can some one please tell me if I am in the right track, and how/if I am able to run the script from within my Java code....
Thanks and regards,
I would like to execute a shell script from my java code. Can some one please tell me if that is possible? Here's what I tried, but with no result.
Java Syntax (Toggle Plain Text)
public class RunPDCC { public static void main(String[] args) { try { Process proc = Runtime.getRuntime().exec("./test.sh"); System.out.println("Print Test Line."); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
In this program, I try to run the "./test.sh" shell script, which-for now-I have, just (echo "Hellow World"). But it doesn't seem that the script runs from within my code.
Can some one please tell me if I am in the right track, and how/if I am able to run the script from within my Java code....
Thanks and regards,
See this thread.. it should answer all your questions and give you enough examples..
Are you Agile.. ?
He-he that is my post, did you get my permision 
Anyway post start here http://www.daniweb.com/forums/thread73182.html with all explanations what I'm trying to do
but real progress is on second page http://www.daniweb.com/forums/thread73182-2.html
In my case this was specialy design for Windows platform, so you will need to make few changes if you want other platform

Anyway post start here http://www.daniweb.com/forums/thread73182.html with all explanations what I'm trying to do
but real progress is on second page http://www.daniweb.com/forums/thread73182-2.html
In my case this was specialy design for Windows platform, so you will need to make few changes if you want other platform
Last edited by peter_budo; Jul 5th, 2007 at 12:01 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Apr 2007
Posts: 126
Reputation:
Solved Threads: 6
Thanks for reply,
Basicaly, what I am trying to accomplish here, is that I wrote a custom class, that is going to be used for a custom method in Documentum, to launch a utility, which we need to run on a weekly basis.
I figured that I when I was testing my code with "./test.sh" script, I didn't have e"x"ecute permission on this script. So, after using "chmod" to grant myself the "x" permission, it started working.
Thanks again for participation,
Basicaly, what I am trying to accomplish here, is that I wrote a custom class, that is going to be used for a custom method in Documentum, to launch a utility, which we need to run on a weekly basis.
I figured that I when I was testing my code with "./test.sh" script, I didn't have e"x"ecute permission on this script. So, after using "chmod" to grant myself the "x" permission, it started working.
Thanks again for participation,
![]() |
Similar Threads
- Sending email from a shell script (Shell Scripting)
- How to su properly in a shell script (Shell Scripting)
- Using Shell Script how to send mail automatically (Shell Scripting)
- Invoking a shell script (PHP)
- shell script for number sequence--- anybody help me? (Shell Scripting)
- Move out java code from jsp (Java)
- Linux Shell Script needs help writing program (Shell Scripting)
- Using find in a bash shell script (Shell Scripting)
Other Threads in the Java Forum
- Previous Thread: String to Object
- Next Thread: [HELP] Stuck once again =[
| Thread Tools | Search this Thread |
6 actuate android api applet application applications array arrays automation balls bank binary bluetooth bold business c++ chat class clear client code codesnippet collections component coordinates database defaultmethod development dice doctype dragging ebook eclipse educational error file formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide ideas image infinite ingres integer intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans openjavafx parameter php problem program programming project recursion repositories scanner scrollbar sell server set sms sort sorting sql sqlserver state storm string sun superclass swing swt threads tree websites windows






