Sometimes the program we write may use other libraries, such as Jai and j3d, which are not included in the default JRE. One method is to install these libraries on the user's client, but there is another simple method, that is, to bring the JRE, put all these libraries into the JRE response directory. In this way, no matter what version of JRE is installed on the client, whether there are all the libraries, our applications can always run through their own JRE.
The method is to create a directory in the RCP Directory, which is called <JRE>. Put the integrated JRE in it and put all the required libraries into it.
Originally, in eclipse. C, there is a code for finding the shipped vm. eclipse.exe will first find out if there is any built-in JVM, and then start it with it:
/* Find the directory where the eclipse program is installed .*/
Programdir = getprogramdir ();
...
/* If the user did not specify a vm to be used */
If (vmname = NULL)
{
/* Determine which type of VM shocould be used .*/
Vmname = (debug | needconsole )? Lelevm: defaultvm );
/* Try to find the VM shipped with eclipse .*/
Shippedvm = malloc (_ tcslen (programdir) + _ tcslen (shippedvmdir) + _ tcslen (vmname) + 10) * sizeof (_ tchar ));
_ Stprintf (shippedvm, _ t_eclipse ("% S % s"), programdir, shippedvmdir, vmname );
JavaVM = findcommand (shippedvm );
/* Format a message to indicate the default VM search path .*/
Vmsearchpath = malloc (_ tcslen (pathmsg) + _ tcslen (shippedvm) + _ tcslen (vmname) + 10) * sizeof (_ tchar ));
_ Stprintf (vmsearchpath, pathmsg, shippedvm, vmname );
Free (shippedvm );
Shippedvm = NULL;
}
Eclipsewin. h
_ Tchar * consolevm = _ T ("java.exe ");
_ Tchar * defaultvm = _ T ("javaw.exe ");
_ Tchar * shippedvmdir = _ T ("JRE // bin //");
In this way, you can use the built-in JRE to solve the problem of incomplete client libraries. Our project adopts this method.