1

I am using some client jars in my component the client jars are compiled and run with java 7.I am not able to move to java 7 due to some management decisions .I want the client jars to work (compile/run) in my java 6 any way i can achieve this?

Thanks

10
  • Do you have access to the source code of the classes? Commented Jul 15, 2013 at 11:48
  • No I dont have access to these source code they are shipped to me as jar.. Commented Jul 15, 2013 at 11:49
  • This question might help. Commented Jul 15, 2013 at 11:51
  • @selig Still requires recompilation. Commented Jul 15, 2013 at 11:51
  • 1
    The management has decided that you shouldn't be using Java 7. I would inform them that they have decided you won't be using the library. BTW Java 6 is end of free service and Java 8 will be available in less than a year. Commented Jul 15, 2013 at 12:13

1 Answer 1

2

I want the client jars to work (compile/run) in my java 6 any way i can achieve this?

If you have source code, you can try compiling the code on a Java 6 build platform. However, there are no guarantees it will compile and run as-is:

  • The code may use Java 7 language constructs.

  • The code may use Java 7 specific classes or methods.

The bad news is that there is no magic way to deal with any compilation errors arising from the above. You will need to hand translate the Java 7-isms into Java 6 compatible source code.

But the good news is that if the code does compile on Java 6 JDK, there is pretty good chance that it will run on Java 6 JRE.


If you don't have access to that source code, then the problem is much, much harder

It is theoretically possible to translate bytecode to an earlier version, but the tools for doing this are tend to have significant limitations. Here are some possible leads:

Note that I've not managed to find a "retro" tool that translates Java 7 to Java 6. (Either nobody has done the work, or there is something about Java 7 makes the problem intractable.)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.