Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Converting simple app from 1.5 jdk to 1.4.2 jdk

 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having some issues coverting my application from 1.5 jdk to 1.4.2. I need to back down the version because it is going to run on a SAP box which they do not want to change at all. I am not sure how to do this. Is it as simple as downloading 1.4.2 and compiling it? I have compiled it on netbeans and have to move it to the SAP machine (Linux) Any help would be appreciated. Thanks.
[ August 10, 2007: Message edited by: Katie Doody ]
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you could continue to use the 5.0 JDK and use a preference to compile it for 1.4.2. (I don't know for sure about NetBeans, but I believe that this is possible in Eclipse).

1. Remove any 5.0 features:
a. Generics
b. enum
c. auto-boxing and auto-unboxing
d. varargs
e. annotations
f. the for-in loop
g. format() and printf() method
h. any new stuff in the API

I think that you should be able to flip the switch to go to 1.4.2 and then handle the compile-time errors as they show up.

Kaydell
[ August 10, 2007: Message edited by: Kaydell Leavitt ]
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. So I would download the sdk and then compile the applicationn in 1.4.2 platform?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You wouldn't need to use 1.4.2 to compile; just use the -source 1.4 -target 1.4 switches to the 5.0 compiler (or use whatever options your IDE offers for targeting a particular JDK version.)

But you should definitely test on 1.4, as using the compiler switches won't stop you from unknowingly using an API that's not available in 1.4.
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you both ..I changed the compile version and it picked up the differences. I have it converted. Good deal.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15485
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could compile on JDK 1.5 with the -source and -target switches as Ernest suggests, but this will not prevent you from using classes that are only in the Java 5 API.

It's safer to download 1.4.2 and compile your program with that. Then at least you will get a compiler error if you are using a class that doesn't exist in Java 1.4.2, instead of a runtime error later on.

Something else you could do is use Retroweaver, which is a tool which makes it possible to run Java 5 code on a Java 1.4.2 JVM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic