platform-core-home/docs/classloader-properties/classloader_properties.html
Parent Directory
|
Revision Log
Revision 1.3 - (view) (download) (as text)
| 1 : | dj | 1.1 | <html> |
| 2 : | <head> | ||
| 3 : | dj | 1.3 | <title>Using the Class Loader Properties File</title> |
| 4 : | dj | 1.1 | </head> |
| 5 : | <body> | ||
| 6 : | dj | 1.3 | <h1>Using the Class Loader Properties File</h1> |
| 7 : | dj | 1.2 | Eclipse 2.0.2 includes many performance enhancements, including some in the area |
| 8 : | dj | 1.1 | of classloading. In order to help out with this a classloader properties file |
| 9 : | was created and this file explains its use. | ||
| 10 : | <p> | ||
| 11 : | |||
| 12 : | dj | 1.3 | <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 : | dj | 1.1 | 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 | ||
| 24 : | the default location (see below) is used for the classloader properties file. | ||
| 25 : | Alternatively the argument can be followed by a path or URL to the appropriate | ||
| 26 : | file to use. | ||
| 27 : | <p> | ||
| 28 : | |||
| 29 : | dj | 1.3 | <h2><a name="location"></a>Location</h2> |
| 30 : | dj | 1.1 | 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. | ||
| 32 : | For instance:<br> | ||
| 33 : | dj | 1.3 | <code>/eclipse/plugins/org.eclipse.core.boot_2.0.2/classloader.properties</code> |
| 34 : | dj | 1.1 | <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> | ||
| 37 : | <code> | ||
| 38 : | -classloaderProperties c:/temp/myfile.properties<br> | ||
| 39 : | -classloaderProperties file:/c:/temp/myfile.properties | ||
| 40 : | </code> | ||
| 41 : | <p> | ||
| 42 : | |||
| 43 : | dj | 1.3 | <h2><a name="format"></a>Format</h2> |
| 44 : | The format of the classloader properties file is a <code>java.util.Properties</code> | ||
| 45 : | 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 : | dj | 1.1 | <p> |
| 48 : | |||
| 49 : | dj | 1.3 | It is quite common for jar files to contain code which reside in multiple packages. For instance, the |
| 50 : | <code>org.eclipse.core.runtime</code> plug-in contains code in the following packages:<br> | ||
| 51 : | dj | 1.1 | <code> |
| 52 : | org.eclipse.core.runtime<br> | ||
| 53 : | org.eclipse.core.internal.runtime,<br> | ||
| 54 : | org.eclipse.core.internal.plugins<br> | ||
| 55 : | dj | 1.3 | org.eclipse.core.runtime.model</code>. |
| 56 : | dj | 1.1 | <p> |
| 57 : | dj | 1.3 | |
| 58 : | In this case, the classloader properties specifies: | ||
| 59 : | <p> | ||
| 60 : | |||
| 61 : | dj | 1.1 | <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 | ||
| 63 : | dj | 1.3 | in the plug-in. The alternative is to declare all 4 prefixes |
| 64 : | dj | 1.1 | 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 | ||
| 66 : | which may include false hits. Depending on the way that your code is structured, | ||
| 67 : | it might be best to list as many as 5-10 package prefixes rather than going | ||
| 68 : | with a more general prefix. For instance, if all your code across multiple plug-ins | ||
| 69 : | contains the same prefix (e.g. <code>com.mycompany</code>) then you will not | ||
| 70 : | be taking full advantage of all benefits if you list only the single prefix | ||
| 71 : | "com.mycompany" in the file. | ||
| 72 : | <p> | ||
| 73 : | |||
| 74 : | dj | 1.3 | When a plug-in contains multiple jar files with code, the entry in the the class loader |
| 75 : | properties file should account for all package prefixes from all jars. | ||
| 76 : | <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 : | the file doesn't mean that your code will not work, it just means that you will | ||
| 79 : | not be able to take advantage of classloading optimization. | ||
| 80 : | <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>) | ||
| 81 : | dj | 1.1 | <p> |
| 82 : | |||
| 83 : | dj | 1.3 | <h2><a name="future"></a>Future</h2> |
| 84 : | dj | 1.1 | 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> | ||
| 86 : | dj | 1.3 | file to take advantage of this classloading performance behavior to make it easier |
| 87 : | dj | 1.1 | for people who are extending the Eclipse platform. |
| 88 : | <p> | ||
| 89 : | |||
| 90 : | dj | 1.3 | <h2><a name="trouble"></a>Trouble-shooting</h2> |
| 91 : | dj | 1.1 | 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 | ||
| 93 : | dj | 1.3 | 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 : | dj | 1.1 | <p> |
| 96 : | |||
| 97 : | </body> | ||
| 98 : | </html> |
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
