File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes java 5 Vs 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java 5 Vs 6" Watch "java 5 Vs 6" New topic

java 5 Vs 6

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 361
I am currently working on an application that was build using java 5.0. Recently I upgraded to java 6.0 and tried to build the application. The build fails. Is java 6.0 not backward compatible.

If i simply run my application on java 6.0 with out building (it has been build on java 5.0), will the application work fine.

Thanks in advance.

SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Martin Vanyavchich
Ranch Hand

Joined: Sep 16, 2008
Posts: 241
As far as I know Java is backwards compatible and you shouldn't experience troubles compiling. Might be, that code uses some features that were deprecated or something similar. Have you tryed using -source 1.5 switch when compiling? Maybe if you posted the errors you get when you compile we coud be of more help.

I no good English.
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Since you are not preparing for SCJP, neither is this question about SCJP, I'll move it to a more appropriate forum...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Henry Wong

Joined: Sep 28, 2004
Posts: 20531

Java 6 is supposed to be backward compatible with Java 5. However...

I have encountered a few Java 5 applications that will not compile correctly with Java 6. And I have encountered a Java 5 application, compiled with Java 5, that will not run correctly in Java 6. I guess there are flaws with the compatibility.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rob Spoor

Joined: Oct 27, 2005
Posts: 20275

Runtime problems may occur, but building (compiling) should still work. Naresh, could you post your build error message(s)?

How To Ask Questions How To Answer Questions
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Sometimes code does change meaning with a new JDK; these are generally obscure cases, but they can be a pain in the class. There are some overloaded versions of StringBuffer::append() that were added in JDK 1.4 and JDK 1.5. Code that in JDK 1.3 might have invoked append(Object) will now invoke append(StringBuffer). If you compile that code with a 1.5 JDK, even if you use -source 1.3 -target 1.3, it won't execute on a 1.3 JRE because that method will be missing. Like I said, obscure, but a huge pain if you bump into it.

[Jess in Action][AskingGoodQuestions]
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

I know about some problems with some drivers too. I got a problem with postgres drivers when migrating my app.

[] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
Raj chiru
Ranch Hand

Joined: Aug 12, 2008
Posts: 142
You got any class version error after building(compiling).
I agree. Here's the link:
subject: java 5 Vs 6
It's not a secret anymore!