Saturday, January 30, 2010

Re: [Java] How to trim unneeded classes from JAR

 

Hello,

Actually, the project is several megabytes in size and I am using
webstart. The concern is not so much the loading of classes from the
JAR file, but the downloading of the JAR file from the web.

Take care
Oliver

On Thu, Jan 7, 2010 at 10:27 PM, Java Guy <javaguy@midnightmusic.net> wrote:
> Oliver,
>
> Unless you have a JAR file that is several megabytes in size that needs
> to be loaded every time the application is loaded (such as a JEE WAR
> file, or the application is in it's own JAR file with other embedded JAR
> files), I wouldn't worry about it. When an application is run, the Java
> Classloaders only load the classes that are used, so if an application
> only uses 10% of the classes in a JAR, then only 10% of those classes
> will be loaded. This is unlike the library systems of C, C++, etc.
>
> Even if you need to worry, as in the exceptions listed above, there are
> ways around the problem.
> 1) If it's a JEE/J2EE application, place extremely large JAR files in
> the application server's shared LIB directory. Then, applications will
> only load what they need.
> 2) If this is a stand-alone application in it's own JAR file, explode
> the JAR and adjust the classpath to reference all classes (the base of
> the .class tree, plus all .jar files). Once again, this will cause the
> classloader to only load what it needs.
>
> -Java Guy
>
>
> Oliver Ruebenacker wrote:
>>
>> Hello,
>>
>> I am participating in a large software project that features a large
>> codebase from which multiple applications can be build. At least one
>> of those application uses only a small fraction of the code, but
>> finding out which classes are needed and which are not would be too
>> cumbersome to track manually. Is there a tool that, given the main
>> class, can trim unneeded classes? Thanks!
>>
>> Take care
>> Oliver
>>
>> --
>> Oliver Ruebenacker, Computational Cell Biologist
>> Systems Biology Linker at Virtual Cell (http://vcell.org/sybil
>> <http://vcell.org/sybil>)
>> Turning Knowledge Data into Models
>> Center for Cell Analysis and Modeling
>> http://www.oliver.curiousworld.org <http://www.oliver.curiousworld.org>
>>
>>
>
>
> ------------------------------------
>
> Visit http://aiaiai.com or http://jgame.org for more groups to join.
> Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
> Whoever posts spam / ads / job related message will be BANNED IMMEDIATELYYahoo! Groups Links
>
>
>
>

--
Oliver Ruebenacker, Computational Cell Biologist
Systems Biology Linker at Virtual Cell (http://vcell.org/sybil)
Turning Knowledge Data into Models
Center for Cell Analysis and Modeling
http://www.oliver.curiousworld.org

__._,_.___
Visit http://aiaiai.com or http://jgame.org for more groups to join.
Java Official Group is created for the following topics: Java 2 Enterprise Edition - J2EE, Java 2 Standard Edition - J2SE, Java 2 Micro Edition - J2ME, XML, XSL, XSD, XPATH, Web Services, Jini, JXTA for all type of Java Geeks.
Whoever posts spam / ads / job related message will be BANNED IMMEDIATELY
.

__,_._,___

No comments:

Post a Comment