Index: ModuleUpdater.java =================================================================== RCS file: /cvs/autoupdate/libsrc/org/netbeans/updater/ModuleUpdater.java,v --- ModuleUpdater.java 1.24.6.1.4.2 +++ ModuleUpdater.java @@ -364,2 +364,3 @@ - + "bin" + FILE_SEPARATOR; // NOI18N - String torun = java_path + "java -cp " + getMainDirString() + mconfig.getCommand(); // NOI18N --- + + "bin" + FILE_SEPARATOR + "java"; // NOI18N + java_path = quoteString(java_path); + String torun = java_path + " -cp " + quoteString(getMainDirString()) + mconfig.getCommand(); // NOI18N @@ -648,0 +649,21 @@ + + /** Quotes string correctly, eg. removes all quotes from the string and adds + * just one at the start and + * second one at the end. + * @param s string to be quoted + * @return correctly quoted string + */ + public static final String quoteString(String s) { + if (s.indexOf(' ') > -1) { + StringBuffer sb = new StringBuffer(s); + int i = 0; + while (i < sb.length()) { + if (sb.charAt(i) == '\"') sb.deleteCharAt(i); + else i++; + } + sb.insert(0, '\"'); + sb.append('\"'); + return sb.toString(); + } + return s; + }