need help connecting to linux server and execute linux commands using local java proj
am practically new to this forum and my apologies first of all coz not sure whether this is the section for this thread...
my req is to create a stand alone java class tht will connect to external linux servers and execute linux commands there...
this is totally new field for me and have no idea on the same.
jus expecting experts to gimme few paths from where i can start my research on...
Re: need help connecting to linux server and execute linux commands using local java
Are you looking to run linux commands from the Java application? If so one way I used that works well is:
Code Java:
String[] commandShutdown = {
"gnome-terminal",
"-e",
"sudo /sbin/shutdown -h now"
};
try {
Runtime.getRuntime().exec(commandShutdown);
} catch {IOExecption e) {
e.printStackTrace();
}
what ever commands you're trying to use you would use the Runtime.