@@ -1111,7 +1111,7 @@ void setEnvironmentVariables(const char *exePath, const int pathLen)
11111111 }
11121112}
11131113
1114- void setMainClassAndClassPath (const char * exePath , const int pathLen )
1114+ void setMainClassAndClassPath (const char * exePath , const int pathLen , BOOL jni )
11151115{
11161116 char classPath [MAX_ARGS ] = {0 };
11171117 char expandedClassPath [MAX_ARGS ] = {0 };
@@ -1179,7 +1179,9 @@ void setMainClassAndClassPath(const char *exePath, const int pathLen)
11791179
11801180 * (launcher .args + strlen (launcher .args ) - 1 ) = 0 ;
11811181 strcat (launcher .args , "\" " );
1182- strcat (launcher .args , launcher .mainClass );
1182+ if (!jni ) {
1183+ strcat (launcher .args , launcher .mainClass );
1184+ }
11831185 }
11841186 else if (wrapper )
11851187 {
@@ -1194,17 +1196,18 @@ void setMainClassAndClassPath(const char *exePath, const int pathLen)
11941196 appendPath (launcher .args , jar );
11951197 strcat (launcher .args , "\"" );
11961198 }
1199+
11971200}
11981201
1199- void setCommandLineArgs (const char * lpCmdLine )
1202+ void setCommandLineArgs (const char * lpCmdLine , BOOL jni )
12001203{
1204+ const char * target = jni ? launcher .mainClass : launcher .args ;
12011205 char tmp [MAX_ARGS ] = {0 };
1202-
12031206 // Constant command line arguments
12041207 if (loadString (CMD_LINE , tmp ))
12051208 {
1206- strcat (launcher . args , " " );
1207- strcat (launcher . args , tmp );
1209+ strcat (target , " " );
1210+ strcat (target , tmp );
12081211 }
12091212
12101213 // Command line arguments
@@ -1226,13 +1229,13 @@ void setCommandLineArgs(const char *lpCmdLine)
12261229 }
12271230 if (* tmp )
12281231 {
1229- strcat (launcher . args , " " );
1230- strcat (launcher . args , tmp );
1232+ strcat (target , " " );
1233+ strcat (target , tmp );
12311234 }
12321235 }
12331236}
12341237
1235- int prepare (const char * lpCmdLine )
1238+ int prepare (const char * lpCmdLine , BOOL jni )
12361239{
12371240 if (!initGlobals ())
12381241 {
@@ -1272,7 +1275,6 @@ int prepare(const char *lpCmdLine)
12721275 }
12731276
12741277 setWorkingDirectory (exePath , pathLen );
1275-
12761278 if (!jreSearch (exePath , pathLen ))
12771279 {
12781280 return FALSE;
@@ -1282,7 +1284,6 @@ int prepare(const char *lpCmdLine)
12821284 {
12831285 return FALSE;
12841286 }
1285-
12861287 setEnvironmentVariables (exePath , pathLen );
12871288 processPriority = loadInt (PRIORITY_CLASS );
12881289 appendLauncher (launcher .cmd );
@@ -1291,8 +1292,8 @@ int prepare(const char *lpCmdLine)
12911292 char jvmOptions [MAX_ARGS ] = {0 };
12921293 setJvmOptions (jvmOptions , exePath );
12931294 expandVars (launcher .args , jvmOptions , exePath , pathLen );
1294- setMainClassAndClassPath (exePath , pathLen );
1295- setCommandLineArgs (lpCmdLine );
1295+ setMainClassAndClassPath (exePath , pathLen , jni );
1296+ setCommandLineArgs (lpCmdLine , jni );
12961297
12971298 debug ("Launcher:\t%s\n" , launcher .cmd );
12981299 debug ("Launcher args:\t%s\n" , launcher .args );
0 commit comments