Added support for "class = manifest".

This causes Getdown to run your app using java -jar code.jar instead of java
-classpath code.jar classname. See wiki docs for more info.
This commit is contained in:
Michael Bayne
2016-02-10 12:02:23 -08:00
parent 78f71839be
commit 4fd707d54d
@@ -57,6 +57,9 @@ public class Application
/** Suffix used for control file signatures. */ /** Suffix used for control file signatures. */
public static final String SIGNATURE_SUFFIX = ".sig"; public static final String SIGNATURE_SUFFIX = ".sig";
/** A special classname that means 'use -jar code.jar' instead of a classname. */
public static final String MANIFEST_CLASS = "manifest";
/** Used to communicate information about the UI displayed when updating the application. */ /** Used to communicate information about the UI displayed when updating the application. */
public static class UpdateInterface public static class UpdateInterface
{ {
@@ -889,7 +892,15 @@ public class Application
public Process createProcess (boolean optimum) public Process createProcess (boolean optimum)
throws IOException throws IOException
{ {
// create our classpath ArrayList<String> args = new ArrayList<String>();
// reconstruct the path to the JVM
args.add(LaunchUtil.getJVMPath(_appdir, _windebug || optimum));
// check whether we're using -jar mode or -classpath mode
boolean dashJarMode = MANIFEST_CLASS.equals(_class);
// add the -classpath arguments if we're not in -jar mode
StringBuilder cpbuf = new StringBuilder(); StringBuilder cpbuf = new StringBuilder();
for (Resource rsrc : getActiveCodeResources()) { for (Resource rsrc : getActiveCodeResources()) {
if (cpbuf.length() > 0) { if (cpbuf.length() > 0) {
@@ -897,15 +908,10 @@ public class Application
} }
cpbuf.append(rsrc.getFinalTarget().getAbsolutePath()); cpbuf.append(rsrc.getFinalTarget().getAbsolutePath());
} }
if (!dashJarMode) {
ArrayList<String> args = new ArrayList<String>();
// reconstruct the path to the JVM
args.add(LaunchUtil.getJVMPath(_appdir, _windebug || optimum));
// add the classpath arguments
args.add("-classpath"); args.add("-classpath");
args.add(cpbuf.toString()); args.add(cpbuf.toString());
}
// we love our Mac users, so we do nice things to preserve our application identity // we love our Mac users, so we do nice things to preserve our application identity
if (RunAnywhere.isMacOS()) { if (RunAnywhere.isMacOS()) {
@@ -951,8 +957,13 @@ public class Application
args.add(processArg(string)); args.add(processArg(string));
} }
// add the application class name // if we're in -jar mode add those arguments, otherwise add the app class name
if (dashJarMode) {
args.add("-jar");
args.add(cpbuf.toString());
} else {
args.add(_class); args.add(_class);
}
// finally add the application arguments // finally add the application arguments
for (String string : _appargs) { for (String string : _appargs) {