•
•
•
•
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,391 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,896 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: 4165 | 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,
•
•
•
•
•
•
•
•
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 =[



Threaded Mode