Lines 208-214
Link Here
|
208 |
if (fileExists(exe)) { |
208 |
if (fileExists(exe)) { |
209 |
return exe.getAbsolutePath(); |
209 |
return exe.getAbsolutePath(); |
210 |
} |
210 |
} |
211 |
|
|
|
212 |
|
211 |
|
213 |
// not found |
212 |
// not found |
214 |
abort(NLS.bind(LaunchingMessages.StandardVMRunner_Specified_executable__0__does_not_exist_for__1__4, new String[]{command, fVMInstance.getName()}), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
213 |
abort(NLS.bind(LaunchingMessages.StandardVMRunner_Specified_executable__0__does_not_exist_for__1__4, new String[]{command, fVMInstance.getName()}), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); |
Lines 297-303
Link Here
|
297 |
addBootClassPathArguments(arguments, config); |
296 |
addBootClassPathArguments(arguments, config); |
298 |
|
297 |
|
299 |
String[] cp= config.getClassPath(); |
298 |
String[] cp= config.getClassPath(); |
|
|
299 |
int cpidx = -1; |
300 |
if (cp.length > 0) { |
300 |
if (cp.length > 0) { |
|
|
301 |
cpidx = arguments.size(); |
301 |
arguments.add("-classpath"); //$NON-NLS-1$ |
302 |
arguments.add("-classpath"); //$NON-NLS-1$ |
302 |
arguments.add(convertClassPath(cp)); |
303 |
arguments.add(convertClassPath(cp)); |
303 |
} |
304 |
} |
Lines 306-315
Link Here
|
306 |
String[] programArgs= config.getProgramArguments(); |
307 |
String[] programArgs= config.getProgramArguments(); |
307 |
addArguments(programArgs, arguments); |
308 |
addArguments(programArgs, arguments); |
308 |
|
309 |
|
|
|
310 |
String[] envp = prependJREPath(config.getEnvironment()); |
311 |
|
312 |
String[] newenvp = checkClasspath(arguments, cp, envp); |
313 |
if(newenvp != null) { |
314 |
envp = newenvp; |
315 |
arguments.remove(cpidx); |
316 |
arguments.remove(cpidx); |
317 |
} |
318 |
|
309 |
String[] cmdLine= new String[arguments.size()]; |
319 |
String[] cmdLine= new String[arguments.size()]; |
310 |
arguments.toArray(cmdLine); |
320 |
arguments.toArray(cmdLine); |
311 |
|
|
|
312 |
String[] envp = prependJREPath(config.getEnvironment()); |
313 |
|
321 |
|
314 |
subMonitor.worked(1); |
322 |
subMonitor.worked(1); |
315 |
|
323 |
|
Lines 356-361
Link Here
|
356 |
} |
364 |
} |
357 |
|
365 |
|
358 |
/** |
366 |
/** |
|
|
367 |
* Returns the index in the given array for the CLASSPATH variable |
368 |
* @param env the environment array or <code>null</code> |
369 |
* @return -1 or the index of the CLASSPATH variable |
370 |
* @since 3.6.200 |
371 |
*/ |
372 |
int getCPIndex(String[] env) { |
373 |
if(env != null) { |
374 |
for (int i = 0; i < env.length; i++) { |
375 |
if(env[i].startsWith("CLASSPATH")) { //$NON-NLS-1$ |
376 |
return i; |
377 |
} |
378 |
} |
379 |
} |
380 |
return -1; |
381 |
} |
382 |
|
383 |
/** |
384 |
* Checks to see if the command / classpath needs to be shortened for Windows. Returns the modified |
385 |
* environment or <code>null</code> if no changes are needed. |
386 |
* |
387 |
* @param args the raw arguments from the runner |
388 |
* @param cp the raw classpath from the runner configuration |
389 |
* @param env the current environment |
390 |
* @return the modified environment or <code>null</code> if no changes were made |
391 |
* @sine 3.6.200 |
392 |
*/ |
393 |
String[] checkClasspath(List<String> args, String[] cp, String[] env) { |
394 |
if(Platform.getOS().equals(Platform.OS_WIN32)) { |
395 |
//count the complete command length |
396 |
int size = 0; |
397 |
for (String arg : args) { |
398 |
if(arg != null) { |
399 |
size += arg.length(); |
400 |
} |
401 |
} |
402 |
//greater than 32768 is a no-go |
403 |
//see http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx |
404 |
if(size > 32768) { |
405 |
StringBuffer newcp = new StringBuffer(); |
406 |
for (int i = 0; i < cp.length; i++) { |
407 |
newcp.append(cp[i]); |
408 |
newcp.append(';'); |
409 |
} |
410 |
int index = getCPIndex(env); |
411 |
if(index < 0) { |
412 |
newcp.insert(0, "CLASSPATH="); //$NON-NLS-1$ |
413 |
if(env == null) { |
414 |
String[] newenv = new String[1]; |
415 |
newenv[0] = newcp.toString(); |
416 |
return newenv; |
417 |
} |
418 |
String[] newenv = new String[env.length+1]; |
419 |
System.arraycopy(env, 0, newenv, 0, env.length); |
420 |
newenv[env.length] = newcp.toString(); |
421 |
return newenv; |
422 |
} |
423 |
String oldcp = env[index]; |
424 |
if(!oldcp.endsWith(";")) { //$NON-NLS-1$ |
425 |
oldcp += ';'; |
426 |
} |
427 |
newcp.insert(0, oldcp); |
428 |
env[index] = newcp.toString(); |
429 |
return env; |
430 |
} |
431 |
} |
432 |
return null; |
433 |
} |
434 |
|
435 |
/** |
359 |
* Prepends the correct java version variable state to the environment path for Mac VMs |
436 |
* Prepends the correct java version variable state to the environment path for Mac VMs |
360 |
* |
437 |
* |
361 |
* @param env the current array of environment variables to run with |
438 |
* @param env the current array of environment variables to run with |