@@ -229,7 +229,7 @@ static class JavacCompiler {
229
229
this .compliance = CompilerOptions .versionToJdkLevel (this .version );
230
230
this .minor = minorFromRawVersion (this .version , rawVersion );
231
231
this .rawVersion = rawVersion ;
232
- this .classpath = "-classpath " ;
232
+ this .classpath = " -classpath " ;
233
233
}
234
234
/** Call this if " -classpath " should be replaced by some other option token. */
235
235
protected void usePathOption (String option ) {
@@ -267,7 +267,7 @@ static String getVersion(String javacPathName) throws IOException, InterruptedEx
267
267
static String getBuild (String javaPathName ) throws IOException , InterruptedException {
268
268
Process fetchVersionProcess = null ;
269
269
try {
270
- fetchVersionProcess = Runtime .getRuntime ().exec (javaPathName + " -version" , env , null );
270
+ fetchVersionProcess = Runtime .getRuntime ().exec (new String [] { javaPathName , " -version"} , env , null );
271
271
Logger versionStdErrLogger = new Logger (fetchVersionProcess .getErrorStream (), "" ); // for javac <= 1.8
272
272
Logger versionStdOutLogger = new Logger (fetchVersionProcess .getInputStream (), "" ); // for javac >= 9
273
273
versionStdErrLogger .start ();
@@ -613,7 +613,7 @@ long compile(File directory, String options, String[] sourceFileNames, StringBui
613
613
} else {
614
614
cmdLineAsString = cmdLine .toString ();
615
615
}
616
- compileProcess = Runtime .getRuntime ().exec (cmdLineAsString .split ("\\ s" ), env , directory );
616
+ compileProcess = Runtime .getRuntime ().exec (cmdLineAsString .split ("\\ s+ " ), env , directory );
617
617
Logger errorLogger = new Logger (compileProcess .getErrorStream (),
618
618
"ERROR" , log == null ? new StringBuilder () : log );
619
619
errorLogger .start ();
@@ -4180,9 +4180,9 @@ private void setupJavac() throws Exception {
4180
4180
javaCommandLineHeader = cmdLineHeader .toString ();
4181
4181
cmdLineHeader = new StringBuilder (jdkRootDirPath .
4182
4182
append ("bin" ).append (JAVAC_NAME ).toString ());
4183
+ String version = JavacCompiler .getVersion (cmdLineHeader .toString ());
4183
4184
cmdLineHeader .append (" -classpath . " );
4184
4185
// start with the current directory which contains the source files
4185
- String version = JavacCompiler .getVersion (cmdLineHeader .toString ());
4186
4186
cmdLineHeader .append (" -d " );
4187
4187
cmdLineHeader .append (JAVAC_OUTPUT_DIR_NAME .indexOf (" " ) != -1 ? "\" " + JAVAC_OUTPUT_DIR_NAME + "\" " : JAVAC_OUTPUT_DIR_NAME );
4188
4188
String firstSupportedVersion = CompilerOptions .getFirstSupportedJavaVersion ();
0 commit comments