•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 402,518 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,739 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 4169 | Replies: 4
![]() |
| |
•
•
Join Date: Apr 2007
Posts: 108
Reputation:
Rep Power: 0
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.
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,
•
•
Join Date: Feb 2007
Location: Bangalore, India
Posts: 535
Reputation:
Rep Power: 4
Solved Threads: 50
See this thread.. it should answer all your questions and give you enough examples..
Are you Agile.. ?
•
•
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,230
Reputation:
Rep Power: 10
Solved Threads: 270
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 11:01 am.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Publilius Syrus
(~100 BC)
If we helped you to solve your problem, answered your question please mark your post as SOLVED.
•
•
Join Date: Apr 2007
Posts: 108
Reputation:
Rep Power: 0
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,
![]() |
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
access activation api blogger blogging blogs code com combo dani daniweb data debugging development dreamweaver dropdownlist gdata google gpl html innovation java key linux microsoft microsoft sdk for java microsystems module net news open openbsd platform product programming reuse rss serial software source sun tags vista web wysiwyg xml
- Sending email from a shell script (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 Shell Script how to send mail automatically (Shell Scripting)
- Using find in a bash shell script (Shell Scripting)
- How to su properly in a shell script (Shell Scripting)
Other Threads in the Java Forum
- Previous Thread: String to Object
- Next Thread: [HELP] Stuck once again =[



Hybrid Mode