Easy way to backport Java 6 code to Java 5?
Asked Answered
N

7

9

We've been developing a windows based application using Java for a while now, but NOW we want to make a mac port and have to reverse of code from Java 6 and Java 5. Is there any easy way to do this rather than re-coding Java 6 specific code? We'd like to keep our code up to date.

Nihility answered 20/8, 2008 at 13:50 Comment(0)
P
4

There are a couple of libraries out there which can help you. Unfortunately I haven't tried them myself, because I've never run into such a situation.

Page answered 21/8, 2008 at 5:45 Comment(0)
S
4

See here:

http://en.wikipedia.org/wiki/Comparison_of_backporting_tools

I tried retrotranslator from 1.6 to 1.4.2 and it works pretty well!

Stevens answered 23/10, 2008 at 16:6 Comment(0)
D
3

Apple released Java 6 on the latest version of OS X. What features are you using specifically from Java6 that aren't in java5?

Dielle answered 20/8, 2008 at 13:57 Comment(2)
Yeah, we've had Java6 for awhile now with leopard, it's just not the default.Gladisgladney
And if it's an applet, java 6 is not an option. Maybe when snow leopard is released (safari will be 64-bit)Holt
E
2

In my experience this is so easy that the whining takes more time than the doing. There are very few things in 1.6 that can't be backported with a minute or so (literally) worth of work. How many compile errors are you seeing when you try it with 1.5, and what for?

Keep in mind that there are readily available, API compatible, low-footprint backports for the few things that are useful in 1.6 (SwingWorker).

Eolian answered 21/8, 2008 at 15:39 Comment(0)
R
1

Do you know how much you would have to rewrite if you just went back to Java 5? If you changes the JDK setting in your IDE and try to recompile it should give you a pretty good idea on how big the changes would actually be. For most developers, Java 6 didn't really offer too much in the way of new features/APIs but I guess it's possible your project depends heavily on something that was added.

Rich answered 20/8, 2008 at 14:0 Comment(3)
No language changes were introduced in Java SE 6, so the target and source options have (almost) no effectStevens
We primarily use Java 6 for the System Tray. All the rest can be fixed with libraries...Ayer
Actually there is a (sort of) language change in Java SE 6: @Override can be used for interface implementations.Borodino
S
0

There is also Java 8 for Mac OS X. New versions of Java would be compatible, like Java 8 is compatible with Java 5 Code, so Java 6 code is compatible too.

Stylographic answered 14/12, 2015 at 7:46 Comment(0)
S
-1

You might be able to backport the additional libraries from Java 6 to Java 5, but I imagine it would be rather more trouble that it's worth. Intel Macs with 64-bit processors (so not the original Intel Mac Mini) running Leopard have Java 6, so perhaps you could just target them?

Serinaserine answered 20/8, 2008 at 13:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.