It is important to configure Squish for Java to use exactly the same JRE (Java Runtime Environment) that your application is using. (You can configure this by running
SQUISH_DIR/setup.) But sometimes it is not obvious which JRE is being used. (It could be one that is bundled with the application, or one of several JREs installed for the user, or a system-wide one.)
Finding the used JRE on Windows using ListDLLs¶
The tool ListDLLs can list the DLLs (and their paths) used by a process:
C:\Users\myuser>listdlls java.exe ListDLLs v3.1 - List loaded DLLs Copyright (C) 1997-2011 Mark Russinovich Sysinternals - www.sysinternals.com ------------------------------------------------------------------------------ java.exe pid: 5824 Command line: java Calculator Base Size Path 0x0000000000400000 0x24000 C:\Windows\SysWOW64\java.exe ... 0x0000000076760000 0xcc000 C:\Windows\syswow64\MSCTF.dll 0x000000007c340000 0x56000 C:\Program Files (x86)\Java\jre6\bin\msvcr71.dll 0x000000006d7f0000 0x2af000 C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll ... 0x000000006d7a0000 0xc000 C:\Program Files (x86)\Java\jre6\bin\verify.dll 0x000000006d320000 0x1f000 C:\Program Files (x86)\Java\jre6\bin\java.dll 0x000000006d7e0000 0xf000 C:\Program Files (x86)\Java\jre6\bin\zip.dll 0x000000006d000000 0x14c000 C:\Program Files (x86)\Java\jre6\bin\awt.dll ... 0x000000006d230000 0x4f000 C:\Program Files (x86)\Java\jre6\bin\fontmanager.dll ... 0x000000006d600000 0x13000 C:\Program Files (x86)\Java\jre6\bin\net.dll ... 0x000000006d620000 0x9000 C:\Program Files (x86)\Java\jre6\bin\nio.dll C:\Users\myuser>
As you can see the above program uses the 32 bit JRE in
C:\Program Files (x86)\Java\jre6. So this implies that a 32 bit Squish for Java package must be used and that it must be configured for this JRE.
(In the example above the target process got identified by entering the executable name “java.exe”. Make sure to specify the executable name of your own application when using ListDLLs. See “listdlls /?” for further options.)
Finding the used JRE on Windows using Process Explorer¶
Even though these steps (and the
Process Explorer application) are Windows specific, similar tools should exist for other platforms:
Quit your application.
Quit any Java application.
Download and start Process Explorer from Microsoft.
Process Explorerpress Control+f or choose
Find Handle or DLL...:
- Search for the text “jvm” (without the quotes):
If you can still find processes which use jvm.dll you must quit/kill these processes first and only proceed when
Process Explorerdoes not find any processes which use
Start your application.
Search for the text “jvm” (without the quotes):
You will probably have to resize the “Handle or DLL” column so that you can see the complete path.
A similar approach is to browse the list of DLLs in a process yourself, as explained in Getting a list of DLLs currently loaded in a process.
How to Find the JRE used by Java applications on Unix (Linux, macOS, etc.)¶
On Unix the general approach is to look at the Java application’s open files; these should include a library called
libjvm.so or similar. This can be done by using the
lsof command and grepping its results, for example:
Of course, to make this work you need to know the running application’s process ID, but you can find that using the
How to Find the JRE used by Eclipse/RCP based applications¶
To find out which Java Runtime Environment (JRE) is being used by Eclipse or an RCP based application START YOUR APPLICATION WITHOUT SQUISH and click
Then click on
And then click on the
In this example the lines…
C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
…indicate that this Eclipse instance is executed by the JRE in
"C:\Program Files (x86)\Java\jre6".
Sometimes these entries are not so easy to spot. In such a case you can select and copy the entire contents of the tab to the clipboard, then paste the text into a text editor and use the editors search or find functionality to locate the “-vm” line.