简体   繁体   中英

How do you drop in substitute JRE classes?

java.util.zip has well-known problems with native memory usage, so i'm trying to use a drop-in replacement called "jazzlib". unfortunately as is typical for sourceforge projects there is no documentation. If I add the jar to my classpath then Java freaks out and gives me "prohibited package name" errors because it replaced java.util.zip. How do I tell Java that this is what I want it to do?

Either add it to the boot class path or add it as an endorsed jar.

Perhaps better, use shade to rename the classes back out of the protected packages, and use them that way. The maven-shade-plugin is convenient if you use maven.

For the latest source, see the classpath CVS repository. On this page you'll find source and binary releases of the code in both the net.sf.jazzlib and java.util.zip namespaces.

Just use the one in net.sf.jazzlib namespace so that you can avoid conflicts.

You can specify overrides for classes provided in the JRE by using the commandline arg -Xbootclasspath . Check this link for more details.

I wouldn't install some random (undocumented) library replacement into my JRE, and certainly I would not do it for a production system, or an application that I intended to provide to someone else. Production support folks will (rightly) have a fit if they are asked to do this sort of thing.

But if you really want to do this, the answers from @bmargulies and @akf are helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM