mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-25 16:07:12 -07:00
Added support for jvm parameters (-Dkey=value)
This commit is contained in:
parent
67ab53f8a3
commit
2d6c8f720c
1 changed files with 12 additions and 3 deletions
|
@ -78,7 +78,7 @@ public class Main {
|
|||
if (! exit) {
|
||||
Path kobaltJarFile = installDistribution();
|
||||
if (!noLaunch) {
|
||||
result = launchMain(kobaltJarFile, kobaltArgv.toArray(new String[kobaltArgv.size()]));
|
||||
result = launchMain(kobaltJarFile, kobaltArgv);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -477,13 +477,22 @@ public class Main {
|
|||
System.out.println("[Wrapper error] *** " + s);
|
||||
}
|
||||
|
||||
private int launchMain(Path kobaltJarFile, String[] argv) throws IOException, InterruptedException {
|
||||
private int launchMain(Path kobaltJarFile, List<String> argv) throws IOException, InterruptedException {
|
||||
List<String> args = new ArrayList<>();
|
||||
args.add("java");
|
||||
args.add("-Dfile.encoding=" + Charset.defaultCharset().name());
|
||||
// jvm parameters must go before -jar
|
||||
Iterator<String> i = argv.iterator();
|
||||
while (i.hasNext()) {
|
||||
String arg = i.next();
|
||||
if (arg.matches("-D(.+?)=(.*)")) {
|
||||
args.add(arg);
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
args.add("-jar");
|
||||
args.add(kobaltJarFile.toFile().getAbsolutePath());
|
||||
Collections.addAll(args, argv);
|
||||
Collections.addAll(args, argv.toArray(new String[argv.size()]));
|
||||
|
||||
ProcessBuilder pb = new ProcessBuilder(args);
|
||||
pb.inheritIO();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue