Impossible to read rt.jar classes?

Hi,

I noticed that recent versions of the rt.jar from Sun are compressed in a way making it impossible to extract files from it?

I need to do this from a Java tool I am creating, but I end ut with a:

java.util.zip.ZipException: invalid CEN header format

And when trying to extract files using winzip I get a CRC error...

I suppose this is a way of protecting the holy rt.jar file from evil hackers or virus programs or something, but for me it is quite frustrating!

I really need to extract these files programatically, are there any workarounds? And, how was this extraction protection added in the first place?

[669 byte] By [javasvada] at [2007-9-26 19:24:26]
# 1
Have you tried:jar -xvf rt.jarV.V.
viravan at 2007-7-3 11:48:46 > top of Java-index,Archived Forums,Java Programming...
# 2
I have been told about license agreements prohibiting you from extracting classes from the RT.JAR.Does any1 actually have a ref to this license agreement since ive been looking and have not seen it!!? Thanks
RcpAnimal at 2007-7-3 11:48:46 > top of Java-index,Archived Forums,Java Programming...
# 3

> Have you tried:

>

> jar -xvf rt.jar

>

> V.V.

>

Yes, that will extract the files even from those CRC-error rt.jar files, however I really need to do this in my own program directly on the rt.jar file, this is an important feature of the tool I am making, unfortunately.

It works on almost every JAR file, except the ones coming with the JRE, which are the most important ones. Even the JDK rt.jar seems fine, but that still does not help me as I cannot rely on any particular version of the rt.jar to be available on my users computer...

javasvada at 2007-7-3 11:48:47 > top of Java-index,Archived Forums,Java Programming...
# 4
I couldn't make the problem manifest reading with PowerArchiver, but it's a bit more tolerant than Winzip. Have you tried replacing your JRE with a fresh download of the same version? It's possible it's been corrupted somehow.
asquithea at 2007-7-3 11:48:47 > top of Java-index,Archived Forums,Java Programming...
# 5
This problem makes 1.4 hard to use with 3rd party IDE's and development tools.
kcakebre at 2007-7-3 11:48:47 > top of Java-index,Archived Forums,Java Programming...
# 6

Why would you need to extract the class files from the rt.jar? Are you trying to perform reflection on the classes? If so you shouldn't need to actually extract the files, if you are just trying to extract the files then what possible need would you have for that? The reason I ask is that there may be other ways around the problem rather than having to pull apart the Jar...

gbentley2000 at 2007-7-3 11:48:47 > top of Java-index,Archived Forums,Java Programming...
# 7
>Does any1 actually have a ref to this license agreement since ive been looking and have not seen it!!?Depends on what you have. Here is one.... http://java.sun.com/j2se/1.3/j2sdk-1_3_1_02-license.html
jschell at 2007-7-3 11:48:47 > top of Java-index,Archived Forums,Java Programming...