@@ -1111,7 +1111,7 @@ void setEnvironmentVariables(const char *exePath, const int pathLen)
1111
1111
}
1112
1112
}
1113
1113
1114
- void setMainClassAndClassPath (const char * exePath , const int pathLen )
1114
+ void setMainClassAndClassPath (const char * exePath , const int pathLen , BOOL jni )
1115
1115
{
1116
1116
char classPath [MAX_ARGS ] = {0 };
1117
1117
char expandedClassPath [MAX_ARGS ] = {0 };
@@ -1179,7 +1179,9 @@ void setMainClassAndClassPath(const char *exePath, const int pathLen)
1179
1179
1180
1180
* (launcher .args + strlen (launcher .args ) - 1 ) = 0 ;
1181
1181
strcat (launcher .args , "\" " );
1182
- strcat (launcher .args , launcher .mainClass );
1182
+ if (!jni ) {
1183
+ strcat (launcher .args , launcher .mainClass );
1184
+ }
1183
1185
}
1184
1186
else if (wrapper )
1185
1187
{
@@ -1194,17 +1196,18 @@ void setMainClassAndClassPath(const char *exePath, const int pathLen)
1194
1196
appendPath (launcher .args , jar );
1195
1197
strcat (launcher .args , "\"" );
1196
1198
}
1199
+
1197
1200
}
1198
1201
1199
- void setCommandLineArgs (const char * lpCmdLine )
1202
+ void setCommandLineArgs (const char * lpCmdLine , BOOL jni )
1200
1203
{
1204
+ const char * target = jni ? launcher .mainClass : launcher .args ;
1201
1205
char tmp [MAX_ARGS ] = {0 };
1202
-
1203
1206
// Constant command line arguments
1204
1207
if (loadString (CMD_LINE , tmp ))
1205
1208
{
1206
- strcat (launcher . args , " " );
1207
- strcat (launcher . args , tmp );
1209
+ strcat (target , " " );
1210
+ strcat (target , tmp );
1208
1211
}
1209
1212
1210
1213
// Command line arguments
@@ -1226,13 +1229,13 @@ void setCommandLineArgs(const char *lpCmdLine)
1226
1229
}
1227
1230
if (* tmp )
1228
1231
{
1229
- strcat (launcher . args , " " );
1230
- strcat (launcher . args , tmp );
1232
+ strcat (target , " " );
1233
+ strcat (target , tmp );
1231
1234
}
1232
1235
}
1233
1236
}
1234
1237
1235
- int prepare (const char * lpCmdLine )
1238
+ int prepare (const char * lpCmdLine , BOOL jni )
1236
1239
{
1237
1240
if (!initGlobals ())
1238
1241
{
@@ -1272,7 +1275,6 @@ int prepare(const char *lpCmdLine)
1272
1275
}
1273
1276
1274
1277
setWorkingDirectory (exePath , pathLen );
1275
-
1276
1278
if (!jreSearch (exePath , pathLen ))
1277
1279
{
1278
1280
return FALSE;
@@ -1282,7 +1284,6 @@ int prepare(const char *lpCmdLine)
1282
1284
{
1283
1285
return FALSE;
1284
1286
}
1285
-
1286
1287
setEnvironmentVariables (exePath , pathLen );
1287
1288
processPriority = loadInt (PRIORITY_CLASS );
1288
1289
appendLauncher (launcher .cmd );
@@ -1291,8 +1292,8 @@ int prepare(const char *lpCmdLine)
1291
1292
char jvmOptions [MAX_ARGS ] = {0 };
1292
1293
setJvmOptions (jvmOptions , exePath );
1293
1294
expandVars (launcher .args , jvmOptions , exePath , pathLen );
1294
- setMainClassAndClassPath (exePath , pathLen );
1295
- setCommandLineArgs (lpCmdLine );
1295
+ setMainClassAndClassPath (exePath , pathLen , jni );
1296
+ setCommandLineArgs (lpCmdLine , jni );
1296
1297
1297
1298
debug ("Launcher:\t%s\n" , launcher .cmd );
1298
1299
debug ("Launcher args:\t%s\n" , launcher .args );
0 commit comments