java - SWT: provide multi-platform download bundles -
for our swt application want provide generic linux download bundle can start on 32-bit- 64-bit-vms. currently, define classpath using manifest , start application using java -jar main.jar
. manifest classpath contains multiple swt*.jars , first matching 1 picked (no problem, because 1 distributed each platform).
simply delivering both swt libraries, swt-linux-32.jar
, swt-linux-64.jar
, looks not promising, because either user have remove wrong 1 manually or script have set whole application classpath dynamically (scary!).
i've thought providing 2 launcher scripts, 1 32-bit-vms , other 64-bit-vms, removing swt.jars manifest classpath , adding right 1 explicitly classpath, e.g. java -cp swt-linux-64.jar -jar main.jar
. unfortunately, looks 1 can't mix explicit classpath definition (-cp
) implicit 1 (-jar
).
one other solution explicitly set classpathes in launcher scripts, make maintaining scripts more complicated.
of course, have alternative load right swt.jar file dynamically in application, i'd prefer keep different file names out of java code.
does has further better suggestion how can manage it?
easy: dynamic classloader manipulation. have loader jar sets new urlclassloader depending on 32/64-bit type of runtime, , load main class there - call main method.
Comments
Post a Comment