File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Converting simple app from 1.5 jdk to 1.4.2 jdk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Converting simple app from 1.5 jdk to 1.4.2 jdk" Watch "Converting simple app from 1.5 jdk to 1.4.2 jdk" New topic
Author

Converting simple app from 1.5 jdk to 1.4.2 jdk

Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
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

Joined: Nov 18, 2006
Posts: 688

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

Joined: Nov 03, 2006
Posts: 90
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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Katie Doody
Ranch Hand

Joined: Nov 03, 2006
Posts: 90
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Converting simple app from 1.5 jdk to 1.4.2 jdk
 
Similar Threads
Simple & Basic EJB application -- Help is needed
Building different branches with different JDK on same box?
Soft Queue Implementations
Jboss not Starting
Java plugin - need old version