| 1 |
<html> |
<html> |
| 2 |
<head> |
<head> |
| 3 |
<title>Using the classloader.properties file</title> |
<title>Using the Class Loader Properties File</title> |
| 4 |
</head> |
</head> |
| 5 |
<body> |
<body> |
| 6 |
<h1>Using the classloader.properties file</h1> |
<h1>Using the Class Loader Properties File</h1> |
| 7 |
Eclipse 2.0.2 includes many performance enhancements, including some in the area |
Eclipse 2.0.2 includes many performance enhancements, including some in the area |
| 8 |
of classloading. In order to help out with this a classloader properties file |
of classloading. In order to help out with this a classloader properties file |
| 9 |
was created and this file explains its use. |
was created and this file explains its use. |
| 10 |
<p> |
<p> |
| 11 |
|
|
| 12 |
<h2>Activation</h2> |
<ul> |
| 13 |
|
<li><a href="#activation">Activation</a></li> |
| 14 |
|
<li><a href="#location">Location</a></li> |
| 15 |
|
<li><a href="#format">Format</a></li> |
| 16 |
|
<li><a href="#future">Future</a></li> |
| 17 |
|
<li><a href="#trouble">Trouble-Shooting</a></li> |
| 18 |
|
</ul> |
| 19 |
|
<p> |
| 20 |
|
|
| 21 |
|
<h2><a name="activation"></a>Activation</h2> |
| 22 |
To enable the classloader performance enhancements, the user must pass the <code>-classloaderProperties</code> |
To enable the classloader performance enhancements, the user must pass the <code>-classloaderProperties</code> |
| 23 |
command-line argument to the Eclipse executable. If the argument is used by itself |
command-line argument to the Eclipse executable. If the argument is used by itself |
| 24 |
the default location (see below) is used for the classloader properties file. |
the default location (see below) is used for the classloader properties file. |
| 26 |
file to use. |
file to use. |
| 27 |
<p> |
<p> |
| 28 |
|
|
| 29 |
<h2>Location</h2> |
<h2><a name="location"></a>Location</h2> |
| 30 |
The default location of the classloader properties file is as a sibling of the <code>boot.jar</code> |
The default location of the classloader properties file is as a sibling of the <code>boot.jar</code> |
| 31 |
in the <code>org.eclipse.core.boot</code> plug-in. |
in the <code>org.eclipse.core.boot</code> plug-in. |
| 32 |
For instance:<br> |
For instance:<br> |
| 33 |
<code>/eclipse/plugins/org.eclipse.core.boot/classloader.properties</code> |
<code>/eclipse/plugins/org.eclipse.core.boot_2.0.2/classloader.properties</code> |
| 34 |
<p> |
<p> |
| 35 |
|
|
| 36 |
If the user specifies the location of the file, it can be either a path or a URL to a file. For instance:<br> |
If the user specifies the location of the file, it can be either a path or a URL to a file. For instance:<br> |
| 40 |
</code> |
</code> |
| 41 |
<p> |
<p> |
| 42 |
|
|
| 43 |
<h2>Format</h2> |
<h2><a name="format"></a>Format</h2> |
| 44 |
The format of the classloader properties file is a <code>java.util.Properties</code> file. The key in the file is the name of the |
The format of the classloader properties file is a <code>java.util.Properties</code> |
| 45 |
plug-in and the value is a comma-separated list of the package prefixes for the packages in the plug-in's jar. |
file. Each key in the file is the name of the plug-in and the value is a comma-separated |
| 46 |
|
list of the package prefixes for the packages in the plug-in's jar. |
| 47 |
<p> |
<p> |
| 48 |
|
|
| 49 |
It is quite common for jar files to contain code which reside in multiple packages. For instance, the <code>runtime.jar</code> file |
It is quite common for jar files to contain code which reside in multiple packages. For instance, the |
| 50 |
in the <code>org.eclipse.core.runtime</code> plug-in contains code in the following packages:<br> |
<code>org.eclipse.core.runtime</code> plug-in contains code in the following packages:<br> |
| 51 |
<code> |
<code> |
| 52 |
org.eclipse.core.runtime<br> |
org.eclipse.core.runtime<br> |
| 53 |
org.eclipse.core.internal.runtime,<br> |
org.eclipse.core.internal.runtime,<br> |
| 54 |
org.eclipse.core.internal.plugins<br> |
org.eclipse.core.internal.plugins<br> |
| 55 |
org.eclipse.core.runtime.model</code>.<p> |
org.eclipse.core.runtime.model</code>. |
|
In this case, in the classloader properties file we put specify the following line: |
|
| 56 |
<p> |
<p> |
| 57 |
|
|
| 58 |
|
In this case, the classloader properties specifies: |
| 59 |
|
<p> |
| 60 |
|
|
| 61 |
<code>org.eclipse.core.runtime=org.eclipse.core</code> |
<code>org.eclipse.core.runtime=org.eclipse.core</code> |
| 62 |
<p> Notice that <code>org.eclipse.core</code> is a common prefix for all packages |
<p> Notice that <code>org.eclipse.core</code> is a common prefix for all packages |
| 63 |
in the <code>runtime.jar</code>. The alternative is to declare all 4 prefixes |
in the plug-in. The alternative is to declare all 4 prefixes |
| 64 |
in the file as a comma-separated list. In this case one must weigh the trade-off |
in the file as a comma-separated list. In this case one must weigh the trade-off |
| 65 |
between the number of checks required against multiple entries and a prefix |
between the number of checks required against multiple entries and a prefix |
| 66 |
which may include false hits. Depending on the way that your code is structured, |
which may include false hits. Depending on the way that your code is structured, |
| 71 |
"com.mycompany" in the file. |
"com.mycompany" in the file. |
| 72 |
<p> |
<p> |
| 73 |
|
|
| 74 |
It is also common for plug-ins to contain multiple jar files with code. In this case all package prefixes from all jars |
When a plug-in contains multiple jar files with code, the entry in the the class loader |
| 75 |
should appear in the classloader properties file. |
properties file should account for all package prefixes from all jars. |
| 76 |
<p> |
<p> Note that missing a package prefix as a value entry in the file means that |
| 77 |
|
your code will not work but not having an entry for your plug-in as a key in |
| 78 |
Note that not having an entry for your plug-in as a key in the file doesn't mean that your code will not work, it just |
the file doesn't mean that your code will not work, it just means that you will |
| 79 |
means that you will not be able to take advantage of classloading optimization. And note that missing a package |
not be able to take advantage of classloading optimization. |
| 80 |
prefix as a value entry in the file does mean that your code will not work. |
<p>See the file which is shipped with Eclipse for an example. (<code>/eclipse/plugins/org.eclipse.core.boot_2.0.2/classloader.properties</code>) |
|
<p> |
|
|
|
|
|
See the file which is shipped with Eclipse for an example. |
|
|
(<code>/eclipse/plugins/org.eclipse.core.boot/classloader.properties</code>) |
|
| 81 |
<p> |
<p> |
| 82 |
|
|
| 83 |
<h2>Future</h2> |
<h2><a name="future"></a>Future</h2> |
| 84 |
As described above, currently one must add all package prefixes to the same properties |
As described above, currently one must add all package prefixes to the same properties |
| 85 |
file. Future work in this area includes the ability to add mark-up to your <code>plugin.xml</code> |
file. Future work in this area includes the ability to add mark-up to your <code>plugin.xml</code> |
| 86 |
file to take advantage of this classloading performance behaviour to make it easier |
file to take advantage of this classloading performance behavior to make it easier |
| 87 |
for people who are extending the Eclipse platform. |
for people who are extending the Eclipse platform. |
| 88 |
<p> |
<p> |
| 89 |
|
|
| 90 |
<h2>Trouble-shooting</h2> |
<h2><a name="trouble"></a>Trouble-shooting</h2> |
| 91 |
If you get a <code>java.lang.ClassNotFoundException</code> then that is an indication that there might be a problem |
If you get a <code>java.lang.ClassNotFoundException</code> then that is an indication that there might be a problem |
| 92 |
with your entries in the properties file. The file could have the correct syntax, but the package prefixes in the |
with your entries in the properties file. The file could have the correct syntax, but the package prefixes in the |
| 93 |
comma-separated list might be missing some entries. The workaround for this is to comment out the line of the offending plug-in. |
comma-separated list might be missing some entries. To verify this is the problem, use a number sign (#) to comment |
| 94 |
|
out the line of the offending plug-in. |
| 95 |
<p> |
<p> |
| 96 |
|
|
| 97 |
</body> |
</body> |