@@ -105,8 +105,18 @@ int main(int argc, char** argv) {
105
105
}
106
106
107
107
jvmVersion = javaInfo[@" JVMVersion" ];
108
- jvmOptionsFile = javaInfo[@" JVMOptionsFile" ];
109
- bootstrapScript = javaInfo[@" BootstrapScript" ];
108
+ if (javaInfo[@" JVMOptionsFile" ] != nil ) {
109
+ NSString *jvmOptFileWithPlaceholders = javaInfo[@" JVMOptionsFile" ];
110
+ jvmOptionsFile = resolvePlaceholders (jvmOptFileWithPlaceholders, javaFolder);
111
+ } else {
112
+ jvmOptionsFile = info[@" JVMOptionsFile" ];
113
+ }
114
+ if (javaInfo[@" BootstrapScript" ] != nil ) {
115
+ NSString *bootstrapFileWithPlaceholders = javaInfo[@" BootstrapScript" ];
116
+ bootstrapScript = resolvePlaceholders (bootstrapFileWithPlaceholders, javaFolder);
117
+ } else {
118
+ bootstrapScript = info[@" BootstrapScript" ];
119
+ }
110
120
} else {
111
121
NSLog (@" [%s ] [PlistStyle] Oracle" , appName);
112
122
javaFolder = [[main bundlePath ] stringByAppendingPathComponent: @" Contents/Java" ];
@@ -151,8 +161,18 @@ int main(int argc, char** argv) {
151
161
}
152
162
153
163
jvmVersion = info[@" JVMVersion" ];
154
- jvmOptionsFile = info[@" JVMOptionsFile" ];
155
- bootstrapScript = info[@" BootstrapScript" ];
164
+ if (javaInfo[@" JVMOptionsFile" ] != nil ) {
165
+ NSString *jvmOptFileWithPlaceholders = javaInfo[@" JVMOptionsFile" ];
166
+ jvmOptionsFile = resolvePlaceholders (jvmOptFileWithPlaceholders, javaFolder);
167
+ } else {
168
+ jvmOptionsFile = info[@" JVMOptionsFile" ];
169
+ }
170
+ if (javaInfo[@" BootstrapScript" ] != nil ) {
171
+ NSString *bootstrapFileWithPlaceholders = javaInfo[@" BootstrapScript" ];
172
+ bootstrapScript = resolvePlaceholders (bootstrapFileWithPlaceholders, javaFolder);
173
+ } else {
174
+ bootstrapScript = info[@" BootstrapScript" ];
175
+ }
156
176
}
157
177
if ([jvmVersion containsString: @" ;" ]) {
158
178
NSArray *stringParts = [jvmVersion componentsSeparatedByString: @" ;" ];
@@ -360,6 +380,10 @@ int main(int argc, char** argv) {
360
380
NSString *optionsFile = [[NSString alloc ] initWithData: [fileManager contentsAtPath: jvmOptionsFile] encoding: NSUTF8StringEncoding];
361
381
NSArray *lines = [optionsFile componentsSeparatedByString: @" \n " ];
362
382
for (NSString *line in lines) {
383
+ // Filter empty lines, otherwise application will fail to start for empty file
384
+ if ([line length ] == 0 ) {
385
+ continue ;
386
+ }
363
387
if ([line hasPrefix: @" #" ]) {
364
388
continue ;
365
389
}
@@ -521,4 +545,4 @@ BOOL versionMeetsMaxConstraint(NSString *version, NSString *constraint) {
521
545
// no modifier means it must match exactly
522
546
return !exceeds && [constraintParts count ] == [versionParts count ];
523
547
}
524
- }
548
+ }
0 commit comments