I hava a program which does an exec of another java program. I get different
results if I run it from the shell. The problem is that exec() doesn't appear to
respect quotes as meaning one argument. Here is the command being execed
and below I'll include the program it is execing.
/net/ubetm/export/ubetm9/boris/dev3/JDK/build/bin/java -classpath .:/home/foley/projects/classes:/net/ubetm/export/ubetm9/boris/dev3/JDK/build/classes:/tmp Frame_0 "hi there"
Frame_0.java
-----------
public class Frame_0 {
public static void main (String args []) {
int i, count;
count = args.length;
if (count > 0) {
System.out.println("count = " + count);
for (i=0; i<count; i++) {
System.out.println(args[i]);
}
}
else {
System.out.println("No args");
}
}
}
From the shell, I get
count = 1
hi there
and from the exec, I get
count = 2
"hi
there"
results if I run it from the shell. The problem is that exec() doesn't appear to
respect quotes as meaning one argument. Here is the command being execed
and below I'll include the program it is execing.
/net/ubetm/export/ubetm9/boris/dev3/JDK/build/bin/java -classpath .:/home/foley/projects/classes:/net/ubetm/export/ubetm9/boris/dev3/JDK/build/classes:/tmp Frame_0 "hi there"
Frame_0.java
-----------
public class Frame_0 {
public static void main (String args []) {
int i, count;
count = args.length;
if (count > 0) {
System.out.println("count = " + count);
for (i=0; i<count; i++) {
System.out.println(args[i]);
}
}
else {
System.out.println("No args");
}
}
}
From the shell, I get
count = 1
hi there
and from the exec, I get
count = 2
"hi
there"