简体   繁体   中英

Can I have my application use my own implementation of a class instead of the class from a external jar

I have a situation where a external jar is loading a class which has a static block to initialise some configurations, i want to stop that happening. the only way i see is to extract that jar and remove that class file and write my own implementaion of that class. can this be done or is there any way i can stop that class from loading and load my own implementation

JAR file is a file format based on the popular ZIP file format and is used for aggregating many files into one. A JAR file is essentially a zip file that contains an optional META-INF directory.

See: https://docs.oracle.com/en/java/javase/11/docs/specs/jar/jar.html

So it is possible to replace a class file. But I would prefer the way vanje suggested in the comment of your question.

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