- Create a file named gandhi.xml in $CATALINA_HOME/conf/Catalina/localhost/
- Type the following configuration:
gandhi" docBase="/home/gandhi/tomcat-home" debug="0" privileged="true">
-gandhi
1: import java.io.*;
2: public class TestExec {
3: public static void main(String[] args) {
4: try {
5: Process p = Runtime.getRuntime().exec("ls");
6: BufferedReader in = new BufferedReader(
7: new InputStreamReader(p.getInputStream()));
8: String line = null;
9: while ((line = in.readLine()) != null) {
10: System.out.println(line);
11: }
12: } catch (IOException e) {
13: e.printStackTrace();
14: }
15: }
16: }
1: import java.io.*;
2: public class TestExec {
3: public static void main(String[] args) {
4: try {
5: String[] complexCommand = {"/bin/bash", "-c", "cat * > total"};
6: Process p = Runtime.getRuntime().exec(complexCommand);
7: BufferedReader in = new BufferedReader(
8: new InputStreamReader(p.getInputStream()));
9: String line = null;
10: while ((line = in.readLine()) != null) {
11: System.out.println(line);
12: }
13: } catch (IOException e) {
14: e.printStackTrace();
15: }
16: }
17: }
dictzip –decompress dictionary.dict.dz