wood burning stoves 2.0*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java 5 Vs 6" Watch "java 5 Vs 6" New topic
Author

java 5 Vs 6

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
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.


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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
author
Sheriff

Joined: Sep 28, 2004
Posts: 18508
    
  40


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.

Henry


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

Joined: Oct 27, 2005
Posts: 19651
    
  18

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

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.


[uaiHebert.com] [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: 141
You got any class version error after building(compiling).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java 5 Vs 6
 
Similar Threads
JDK and Java2 Platform
SCJP Exam time 175 or 210
Not able to execute a sample jsp file
Java: need help installing
Help ! Migration WAS 5.0 to 6.0 -32 bit to 64 bit