edha edha - 1 year ago 123
Java Question

How to compile java files in jar to byte code (*.class file)

How to compile java files in jar file to byte code (*.class file)?

Answer Source

Since a jar is an archive of java-related files and perhaps metadata, they can really hold just about anything. They are just zip archives with a different name. Typically you find "regular" jar's (containing .class files) and source jar's (containing .java files).

It sounds like you might have a source jar and you need the regular jar that contains the compiled classes. If this is a jar you've downloaded from someplace, perhaps you should look for it's compiled counterpart. If this is a jar that you've built yourself, then you skipped the compile step and built yourself a source-jar.

If it is none of the above, then, like others have pointed out, unzip it and compile the classes. Just know that there may be other hurdles involved when it comes to satisfying all the jar's dependencies. Unless, it came with a pom for you to use or reference.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download