JNI Exception: Failed to create the Java VM

Having trouble running Advanced Installer? Got a bug to report? Post it all here.

JNI Exception: Failed to create the Java VM

Postby andanthor » Sat Apr 22, 2006 12:46 am

I'm having a problem runing a java app installed with Advanced Installer. When I try to run the exe file, I get an error message "JNI Exception: Failed to create the Java VM".

I read a few post that try to solve this around the VM parameters, but I tried eliminating the parameters completely but I get the same error message. The weird thing is that the same installer works on some machines and it doesnt on others. I still have not determined what configuration can be linked to the error. I do believe it has to do with the JRE being used. Is there a way to force the app to use the jre I embedded with the app? it seems to be installed fine, but I dont think the app is using it...
andanthor
 
Posts: 1
Joined: Sat Apr 22, 2006 12:40 am

Postby Mihai » Wed Apr 26, 2006 8:29 am

Hi,

If the package with bundle JRE was installed then the java application always uses the bundled version of JRE. You must find in the INI file an entry named "JRE Path" set to the installation directory of your application.

If not, you can force the usage of a specific VM, by opening the INI file and adding the "JRE Path" entry:

Code: Select all
[Java Runtime Environment]
JRE Path = <path_to_jre>


Could you please list the INI file of your application so we could have more details about your java application?

Also, if you will provide us a mail address we could send you some debug versions of java launcher so you could better investigate this problem.

Waiting for your answer,
Mihai
Mihai Udrea
Advenced Installer Team
Mihai
 
Posts: 38
Joined: Wed Mar 23, 2005 12:19 pm

is there a way to set the JRE path at install time?

Postby davincicode » Wed Jul 12, 2006 5:56 pm

We are making a Java utility that will install on a machine that already has a VM installed. It is not the Sun VM, so the normal Sun VM rules do not apply.

In order to run our utility, we need to be able to look in the registry and see where the VM was installed and then pass this information to the Advanced Installer Java launcher.

Is there any way to do this?

I know in exe4j that you can specify an environment variable or registry key for how to find the JRE. Better yet would be a C DLL that you provide that returns the JRE path (or some way of calling VBscript for instance).

Also, if we search for a JVM and find for some reason it has not been installed, we would like to download a JVM. So we need some way of controlling the flow in the launcher so it uses one if our function returns the location of the installed VM or downloads one if nothing is found.

What are my options for Advanced Installer?
davincicode
 
Posts: 7
Joined: Wed Apr 13, 2005 1:49 pm

Postby Ionut » Fri Jul 14, 2006 5:42 pm

Hi,

In order to run our utility, we need to be able to look in the registry and see where the VM was installed and then pass this information to the Advanced Installer Java launcher.

The AI Java Launcher works only with the JRE provided by Sun. The path to the JRE in the INI file is used to locate the "jvm.dll" file. If the VM you are targeting is not compatible with the one provided by Sun, it is unlikely that setting the path will work.

On another note, locating the VM should not pose a problem. You could use a Registry or File Search. Writing the path in the INI file would be done using a Custom Action. As noted above, the JRE must be compatible with the one provided by Sun.

Also, if we search for a JVM and find for some reason it has not been installed, we would like to download a JVM.

You can use a Prerequisite for this purpose (Media page -> "Prerequistes" tab) such that the JRE is downloaded and installed if the specified Search Criteria is not satisfied.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
Ionut
 
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am

Postby davincicode » Fri Jul 14, 2006 11:08 pm

In order to run our utility, we need to be able to look in the registry and see where the VM was installed and then pass this information to the Advanced Installer Java launcher.

The AI Java Launcher works only with the JRE provided by Sun. The path to the JRE in the INI file is used to locate the "jvm.dll" file. If the VM you are targeting is not compatible with the one provided by Sun, it is unlikely that setting the path will work.


The VM we are targeting is compatible with Sun's at the Java level. It is from a very old and large technology company that is a major supporter of the Java and open source communities. However, it does not have a "jvm.dll" file. The Java VM DLLs (and there are two) have different names.

On another note, locating the VM should not pose a problem. You could use a Registry or File Search. Writing the path in the INI file would be done using a Custom Action. As noted above, the JRE must be compatible with the one provided by Sun.


Is there any way to use a different file name instead of JVM.DLL with the latest version of Advanced Installer? Will a future version of Advanced Installer allow us to specify a different DLL name?

Also, is there an example you can point me towards that shows where/how to do such a Custom Action?

Also, if we search for a JVM and find for some reason it has not been installed, we would like to download a JVM.

You can use a Prerequisite for this purpose (Media page -> "Prerequistes" tab) such that the JRE is downloaded and installed if the specified Search Criteria is not satisfied.


This is good.

Regards,
Ionut


Thanks for the help. Sorry I had to bug you... we just have a big deadline for that very large company that we must hit next week!
davincicode
 
Posts: 7
Joined: Wed Apr 13, 2005 1:49 pm

Postby Ionut » Mon Jul 17, 2006 5:37 pm

Hi,

Is there any way to use a different file name instead of JVM.DLL with the latest version of Advanced Installer?

The problem is not the name of the DLL (you could rename one of the VM DLLs), but rather the exported functions which the AI Java Launcher will attempt to invoke.

Also, is there an example you can point me towards that shows where/how to do such a Custom Action?

I could give you an example but this would not help (for the reason mentioned above). However, you should test whether setting the JRE path manually in the Java Launcher INI file (in addition to renaming one of the VM DLLs to "jvm.dll") works. Make sure that the directory layout of the Sun JRE is respected (that is, <JRE folder>\bin\client\jvm.dll).

Will a future version of Advanced Installer allow us to specify a different DLL name?

Please give me more details about this VM and perhaps we shall add support for it in a future version. You can send an email to our support address if you prefer.

===

I would suggest that you launch the corresponding "java.exe" binary through a shortcut with the appropriate parameters in order to start your Java application.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
Ionut
 
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am

Postby davincicode » Tue Jul 18, 2006 5:21 am

Thank you, Denis, for educating me on what is going on.

Making a simple Java launcher became too much work with Advanced Installer.

Instead, I am now using exe4j.

With exe4j, it is very easy to make a Java launcher that uses a non-standard VM.

I think Advanced Installer is great for making Windows installers, but is still coming up to speed on making Java launchers. The complexity is way over the top.

Also, I would also add that the complexity of Advanced Installer is also becoming a bit much. Too many basic things are hidden away in properties, custom actions, and other aspects of using the product that are not well explained, not well documented, and not easy to use.

It is very different than the early versions of Advanced Installer that were lean and mean 'get your work done fast' tools. I think it is time to refactor. You guys definitely have the talent to make great software. Maybe it is time to look deeply at Advanced Installer and go through the workflows to make them simple to use again? Just a thought... ;-)
davincicode
 
Posts: 7
Joined: Wed Apr 13, 2005 1:49 pm

Postby Ionut » Tue Jul 18, 2006 1:30 pm

Hi,

Making a simple Java launcher became too much work with Advanced Installer.

I apologize for not being clear in my previous post. I was trying to give you some hints on how you could test whether the AI Java Launcher is compatible with your VM. The truth is that currently the launcher has been tested only with the Sun JRE and it is unlikely that it is compatible with a VM with a different architecture such as yours.

If you could give me some details about this VM we shall investigate and add support for it in a future version.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
Ionut
 
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am


Return to Common Problems

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests