Java 1.5 to 1.4

What is the best way to convert an existing jar (without source) written in java 1.5 to java 1.4.x?

+6
java
source share
6 answers

Take a look at Retroweaver . It converts classes or jars so that they can be run using the 1.4 JRE. Depending on the features used 1.5, you will not need additional recruiter execution time.

Retroweaver uses the byte code extension. It sounds mysterious, but it works.

+12
source share

retrotranslator is another option similar to retroweaver

+3
source share

You can decompile it and then recompile it. You may have to fix incompatibilities manually. Here is the thread on java decompiler .

+1
source share

My gut instinct was to decompile the jar and then recompile as 1.4.

If there are no 1.5 specific API calls in the decompiled code, this should work fine. If so, you will need to rebuild these sections to work in an earlier version of Java.

0
source share

Like decompilation, you probably have to reorganize a few things in the source code - enumerations, generics (I don’t think that generics will be in decompiled code, but that probably means you miss some throws), boxing / unpacking and etc. etc.

0
source share

as Rodeclone said
1) unzip the JAR

2) use a decompiler like jad ( http://www.kpdus.com/jad.html ), using parameters like these jad -d src -f -ff -s.java -space -t4 ***. the class

3) and from the generated source files, compile them using JDK 1.4 javac.

4) if compiler 1.4 is working fine, return to the new jar

5) if compiler 1.4 has problems, you need to use retroweaver ( http://retroweaver.sourceforge.net/index.html ).
This may work in some cases, but if the class expects changes in the JVM, then you are in a difficult place. If the classes use the new streaming facility, you can use the util.concurrent JDK 1.4 version from http://g.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html .

Good luck

0
source share

All Articles