appbundle-maven-plugin
appbundle-maven-plugin copied to clipboard
Embedding JVM and using it
Hello,
first of all greetings for your project it is very well described, implemented and extremely useful to facilitate the distribution of java programs on OSx! I come with a question for you: I need my application to bundle a correct Java Virtual Machine, because I don't want to force my users to install a Java Virtual Machine on their MAC. So, I followed your steps, and in fact a JVM is embedded in the Application.App package. The problem is that when I try to execute the application on a MAC without Java installed (I did this by simply removing my installed JVM), the application does not start because it complains that Java is not installed. Can you tell me how I can tell OSx to use the embedded Java Virtual Machine, or how I can configure this option? Thank you very much,
Lorenzo
I think it might be a bug.
Please show me more details; logs, operating histories, etc.
Hi,
thank you for your reply. Quickly done, the situation is the following: as I told you, I compiled the .app directly on a MAC (OSx 10.10.5 Yosemite) with JVM 1.8u65 JDK installed (the latest available), and the JVM is in fact packaged in the .app. When I try to run it, it works perfectly while the JVM is still installed on the MAC (runs smoothly and the GUI starts without any kind of problem). If I remove the JVM 1.8 from the MAC (I still leave installed the JVM 1.6, which was already there from the beginning, but I don't think this changes a lot, since I tried on other MACs as well), I got an UnsupportedClassVersionError when Java 1.6 is installed (indicating, to me, that the system tries to use the installed Java instead of the embedded one). When I try running on a MAC without any Java (I tested on a MAC with OSx 10.11, ElCapitan), I simply got a prompt telling me that I should download and install a JRE.
On both systems, if I go from the terminal and I run from command line the JVM embedded in the app package, everything works fine again.
So, my guess is that when the JavaAppLauncher executable is built, somehow it does not point to the embedded JRE, but it defaults to the system installation, even if the JRE is correctly embedded.
Thank you for your time, and if you need any other information please ask.
If this could be of any help, I think the problem could be here (code is taken from your native main.m):
const char *libjliPath = NULL;
if (runtime != nil && [runtime length] > 0) {
NSString *runtimePath = [[[NSBundle mainBundle] builtInPlugInsPath] stringByAppendingPathComponent:runtime];
libjliPath = [[runtimePath stringByAppendingPathComponent:@"Contents/Home/jre/lib/jli/libjli.dylib"] fileSystemRepresentation];
} else {
libjliPath = LIBJLI_DYLIB;
}
Apparently, there is something wrong with the defined path.I am not really sure how I can change the code since it is a maven plugin, so I will wait for your reply.