貌似是环境变量设置不全引起的.
Hi,
I am using new Antenna 1.2.0-beta with Java ME SDK 3.0. I have a problem during preverification. I 'm getting error:
[INFO] Preverification failed (result=-1072365564)
[INFO] ----------------------------------------------------------------
[INFO] Trace
Preverification failed (result=-1072365564)
at de.pleumann.antenna.misc.Utility.preverify(Utility.java:566)
I checked your code and I found the reason. At least I think so. In preverify() method you do:
// prepend java bin path to system PATH calling preverify
String env[] = new String[]{
"PATH=" + java_bin + System.getProperty("path.separator") + System.getenv("PATH")
};
Process proc = Runtime.getRuntime().exec(preverify + " " + arguments, env);
I checked this fragment and if I change exec() method to form without env argument everything works ok:
Process proc = Runtime.getRuntime().exec(preverify + " " + arguments);
Probably you invoke version with env arg, because you want to add proper JAVA folder to PATH.
In my opinion you should pass all the system ENV variables together with modified PATH. Then everything will work.
Map<String, String> map = new HashMap<String, String>(System.getenv());
List<String> list = new ArrayList<String>(maps.size());
for (Entry<String, String> e : map.entrySet()) {
list.add(e.getKey() + "=" + e.getValue());
}
// modify PATH
Process exec = Runtime.getRuntime().exec(cmd, list.toArray(new String[0]));
I found that in my case it was 'SystemRoot' env variable that caused a problem. I think that two args exec(...) method works different than one arg. In one arg, all the system variables are passed to child process, in 2-arg you pass only what you declare in table, so it would be safer to copy all variables to table modify PATH position and pass to exec. This problem may depends on operating system.
Hi,
I am using new Antenna 1.2.0-beta with Java ME SDK 3.0. I have a problem during preverification. I 'm getting error:
[INFO] Preverification failed (result=-1072365564)
[INFO] ----------------------------------------------------------------
[INFO] Trace
Preverification failed (result=-1072365564)
at de.pleumann.antenna.misc.Utility.preverify(Utility.java:566)
I checked your code and I found the reason. At least I think so. In preverify() method you do:
// prepend java bin path to system PATH calling preverify
String env[] = new String[]{
"PATH=" + java_bin + System.getProperty("path.separator") + System.getenv("PATH")
};
Process proc = Runtime.getRuntime().exec(preverify + " " + arguments, env);
I checked this fragment and if I change exec() method to form without env argument everything works ok:
Process proc = Runtime.getRuntime().exec(preverify + " " + arguments);
Probably you invoke version with env arg, because you want to add proper JAVA folder to PATH.
In my opinion you should pass all the system ENV variables together with modified PATH. Then everything will work.
Map<String, String> map = new HashMap<String, String>(System.getenv());
List<String> list = new ArrayList<String>(maps.size());
for (Entry<String, String> e : map.entrySet()) {
list.add(e.getKey() + "=" + e.getValue());
}
// modify PATH
Process exec = Runtime.getRuntime().exec(cmd, list.toArray(new String[0]));
I found that in my case it was 'SystemRoot' env variable that caused a problem. I think that two args exec(...) method works different than one arg. In one arg, all the system variables are passed to child process, in 2-arg you pass only what you declare in table, so it would be safer to copy all variables to table modify PATH position and pass to exec. This problem may depends on operating system.