platform-core-home/docs/classloader-properties/classloader_properties.html
Parent Directory
|
Revision Log
Revision 1.4 - (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.4 | |
| 8 : | <em>Last update: October 25, 2002</em> | ||
| 9 : | <p> | ||
| 10 : | |||
| 11 : | dj | 1.2 | Eclipse 2.0.2 includes many performance enhancements, including some in the area |
| 12 : | dj | 1.1 | of classloading. In order to help out with this a classloader properties file |
| 13 : | was created and this file explains its use. | ||
| 14 : | <p> | ||
| 15 : | |||
| 16 : | dj | 1.3 | <ul> |
| 17 : | <li><a href="#activation">Activation</a></li> | ||
| 18 : | <li><a href="#location">Location</a></li> | ||
| 19 : | <li><a href="#format">Format</a></li> | ||
| 20 : | <li><a href="#future">Future</a></li> | ||
| 21 : | <li><a href="#trouble">Trouble-Shooting</a></li> | ||
| 22 : | dj | 1.4 | <li><a href="#example">Example File</a></li> |
| 23 : | dj | 1.3 | </ul> |
| 24 : | <p> | ||
| 25 : | |||
| 26 : | <h2><a name="activation"></a>Activation</h2> | ||
| 27 : | dj | 1.1 | To enable the classloader performance enhancements, the user must pass the <code>-classloaderProperties</code> |
| 28 : | command-line argument to the Eclipse executable. If the argument is used by itself | ||
| 29 : | the default location (see below) is used for the classloader properties file. | ||
| 30 : | Alternatively the argument can be followed by a path or URL to the appropriate | ||
| 31 : | file to use. | ||
| 32 : | <p> | ||
| 33 : | |||
| 34 : | dj | 1.3 | <h2><a name="location"></a>Location</h2> |
| 35 : | dj | 1.1 | The default location of the classloader properties file is as a sibling of the <code>boot.jar</code> |
| 36 : | in the <code>org.eclipse.core.boot</code> plug-in. | ||
| 37 : | For instance:<br> | ||
| 38 : | dj | 1.3 | <code>/eclipse/plugins/org.eclipse.core.boot_2.0.2/classloader.properties</code> |
| 39 : | dj | 1.1 | <p> |
| 40 : | |||
| 41 : | If the user specifies the location of the file, it can be either a path or a URL to a file. For instance:<br> | ||
| 42 : | <code> | ||
| 43 : | -classloaderProperties c:/temp/myfile.properties<br> | ||
| 44 : | -classloaderProperties file:/c:/temp/myfile.properties | ||
| 45 : | </code> | ||
| 46 : | <p> | ||
| 47 : | |||
| 48 : | dj | 1.4 | It is important to note that the file which is used by the system (either the default or the one |
| 49 : | which is specified by the user) is <b>exclusive</b> and does <b>not</b> represent the intersection between | ||
| 50 : | multiple files. That being said, if the user specifies a particular file to use, then the contents of the default | ||
| 51 : | file must be merged with it in order for the class loader enhancements to take effect for the | ||
| 52 : | classes in the Eclipse Platform; the contents of the default file are not automatically used. | ||
| 53 : | <p> | ||
| 54 : | |||
| 55 : | dj | 1.3 | <h2><a name="format"></a>Format</h2> |
| 56 : | The format of the classloader properties file is a <code>java.util.Properties</code> | ||
| 57 : | file. Each key in the file is the name of the plug-in and the value is a comma-separated | ||
| 58 : | list of the package prefixes for the packages in the plug-in's jar. | ||
| 59 : | dj | 1.1 | <p> |
| 60 : | |||
| 61 : | dj | 1.3 | It is quite common for jar files to contain code which reside in multiple packages. For instance, the |
| 62 : | <code>org.eclipse.core.runtime</code> plug-in contains code in the following packages:<br> | ||
| 63 : | dj | 1.1 | <code> |
| 64 : | org.eclipse.core.runtime<br> | ||
| 65 : | org.eclipse.core.internal.runtime,<br> | ||
| 66 : | org.eclipse.core.internal.plugins<br> | ||
| 67 : | dj | 1.3 | org.eclipse.core.runtime.model</code>. |
| 68 : | dj | 1.1 | <p> |
| 69 : | dj | 1.3 | |
| 70 : | In this case, the classloader properties specifies: | ||
| 71 : | <p> | ||
| 72 : | |||
| 73 : | dj | 1.1 | <code>org.eclipse.core.runtime=org.eclipse.core</code> |
| 74 : | <p> Notice that <code>org.eclipse.core</code> is a common prefix for all packages | ||
| 75 : | dj | 1.3 | in the plug-in. The alternative is to declare all 4 prefixes |
| 76 : | dj | 1.1 | in the file as a comma-separated list. In this case one must weigh the trade-off |
| 77 : | between the number of checks required against multiple entries and a prefix | ||
| 78 : | which may include false hits. Depending on the way that your code is structured, | ||
| 79 : | it might be best to list as many as 5-10 package prefixes rather than going | ||
| 80 : | with a more general prefix. For instance, if all your code across multiple plug-ins | ||
| 81 : | contains the same prefix (e.g. <code>com.mycompany</code>) then you will not | ||
| 82 : | be taking full advantage of all benefits if you list only the single prefix | ||
| 83 : | "com.mycompany" in the file. | ||
| 84 : | <p> | ||
| 85 : | |||
| 86 : | dj | 1.3 | When a plug-in contains multiple jar files with code, the entry in the the class loader |
| 87 : | properties file should account for all package prefixes from all jars. | ||
| 88 : | <p> Note that missing a package prefix as a value entry in the file means that | ||
| 89 : | your code will not work but not having an entry for your plug-in as a key in | ||
| 90 : | the file doesn't mean that your code will not work, it just means that you will | ||
| 91 : | not be able to take advantage of classloading optimization. | ||
| 92 : | <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>) | ||
| 93 : | dj | 1.1 | <p> |
| 94 : | |||
| 95 : | dj | 1.3 | <h2><a name="future"></a>Future</h2> |
| 96 : | dj | 1.1 | As described above, currently one must add all package prefixes to the same properties |
| 97 : | file. Future work in this area includes the ability to add mark-up to your <code>plugin.xml</code> | ||
| 98 : | dj | 1.3 | file to take advantage of this classloading performance behavior to make it easier |
| 99 : | dj | 1.1 | for people who are extending the Eclipse platform. |
| 100 : | <p> | ||
| 101 : | |||
| 102 : | dj | 1.3 | <h2><a name="trouble"></a>Trouble-shooting</h2> |
| 103 : | dj | 1.1 | If you get a <code>java.lang.ClassNotFoundException</code> then that is an indication that there might be a problem |
| 104 : | with your entries in the properties file. The file could have the correct syntax, but the package prefixes in the | ||
| 105 : | dj | 1.3 | comma-separated list might be missing some entries. To verify this is the problem, use a number sign (#) to comment |
| 106 : | out the line of the offending plug-in. | ||
| 107 : | dj | 1.4 | <p> |
| 108 : | |||
| 109 : | <h2><a name="example"></a>Example File</h2> | ||
| 110 : | Here is an example of the <code>classloader.properties</code> file which ships with | ||
| 111 : | Eclipse 2.0.2. | ||
| 112 : | <p> | ||
| 113 : | <code> | ||
| 114 : | <blockquote> | ||
| 115 : | <pre> | ||
| 116 : | org.apache.ant = org.apache.tools | ||
| 117 : | org.apache.lucene = org.apache.lucene | ||
| 118 : | org.apache.xerces = org.apache, org.w3c.dom, org.xml.sax, javax.xml | ||
| 119 : | org.eclipse.ant.core = org.eclipse.ant | ||
| 120 : | org.eclipse.compare = org.eclipse.compare | ||
| 121 : | org.eclipse.core.resources = org.eclipse.core | ||
| 122 : | org.eclipse.core.runtime = org.eclipse.core | ||
| 123 : | org.eclipse.debug.core = org.eclipse.debug.core, org.eclipse.debug.internal.core | ||
| 124 : | org.eclipse.debug.ui = org.eclipse.debug.ui, org.eclipse.debug.internal.ui | ||
| 125 : | org.eclipse.help = org.eclipse.help | ||
| 126 : | org.eclipse.help.ui = org.eclipse.help.ui | ||
| 127 : | org.eclipse.jdt.core = org.eclipse.jdt.core, org.eclipse.jdt.internal | ||
| 128 : | org.eclipse.jdt.debug = com.sun.jdi, org.eclipse.jdi, org.eclipse.jdt | ||
| 129 : | org.eclipse.jdt.debug.ui = org.eclipse.jdt.debug.ui, org.eclipse.jdt.internal.debug.ui | ||
| 130 : | org.eclipse.jdt.junit = org.eclipse.jdt.internal.junit | ||
| 131 : | org.eclipse.jdt.launching = org.eclipse.jdt.launching, org.eclipse.jdt.internal.launching | ||
| 132 : | org.eclipse.jdt.ui = org.eclipse.jdt.internal, org.eclipse.jdt.ui | ||
| 133 : | org.eclipse.pde.build = org.eclipse.pde.internal.build | ||
| 134 : | org.eclipse.pde.core = org.eclipse.pde.core, org.eclipse.pde.internal.core | ||
| 135 : | org.eclipse.pde.runtime = org.eclipse.pde.internal.runtime | ||
| 136 : | org.eclipse.pde.ui = org.eclipse.pde.ui, org.eclipse.pde.internal.ui | ||
| 137 : | org.eclipse.search = org.eclipse.search | ||
| 138 : | org.eclipse.swt = org.eclipse.swt | ||
| 139 : | org.eclipse.team.core = org.eclipse.team.core, org.eclipse.team.internal.core | ||
| 140 : | org.eclipse.team.cvs.core = org.eclipse.team.internal.ccvs.core | ||
| 141 : | org.eclipse.team.cvs.ssh = org.eclipse.team.internal.ccvs.ssh | ||
| 142 : | org.eclipse.team.cvs.ui = org.eclipse.team.internal.ccvs.ui | ||
| 143 : | org.eclipse.team.ui = org.eclipse.team.ui, org.eclipse.team.internal.ui | ||
| 144 : | org.eclipse.ui = org.eclipse.ui, org.eclipse.jface | ||
| 145 : | org.eclipse.ui.externaltools = org.eclipse.ui.externaltools | ||
| 146 : | org.eclipse.update.core = org.eclipse.update | ||
| 147 : | org.eclipse.update.ui = org.eclipse.update.internal.ui | ||
| 148 : | org.eclipse.update.forms = org.eclipse.update.ui.forms | ||
| 149 : | org.junit = junit | ||
| 150 : | </pre> | ||
| 151 : | </blockquote> | ||
| 152 : | </code> | ||
| 153 : | |||
| 154 : | dj | 1.1 | <p> |
| 155 : | |||
| 156 : | </body> | ||
| 157 : | </html> |
| help@eclipse.org | ViewVC Help |
| Powered by ViewVC 1.0.3 |
