Hi All, I build my web app war file in an environment where java_home is jre1.4.2_06. I am running the web app with tomcat-4.1.31 on another machine that has java jre1.6.0_01. I am getting some wierd behavior, and am not sure if maybe I have to build and run using the same java version. Thanks for any input, Kim
Newer versions of Java should be able to run code from older versions without modifications, so code compiled on Java 1.4 should run on Java 6. It is possible, however, that there are small incompatibilities, see: Java SE 6 - Compatibility.
But maybe the problems that you are getting are not at all caused by the version difference. Please explain what problems / strange things you are seeing, maybe we can help you to find out what the cause is.
Thank you very much for your reply. Its hard to post the code here because it is long, but in a nutshell, I save some objects into an ArrayList, and put the ArrayList into the session. In another part of the code I get the ArrayList out of the session, and when I try to use it I hit a null pointer exception. The thing that is strange is that I never hit this exception when I have the same war file running on a machine using the older version of java, it only happens with the newer version.
You'll just have to debug your software on the new Java version (where you can reproduce the problem). Add log statements in strategic places so that you can follow what the program does, or run your program in a debugger so that you can go through it step by step to see what it does.
Joined: May 17, 2001
Thanks Jesper, very good advice. I was stalling from doing this as my environment has changed greatly since writing this older code. I bit the bullet and did this and was able to fix my problem.
What is strange is that the code did work using our older java but not with the updated java.
It turned out to be a problem in my struts-config.xml file.
You know how in an action you have forwards that are to another action, or to a jsp page? The syntax on my forward to another action was a bit off, and it seems like the older java was OK with it, but the newer one did not "like" the syntax. Instead of throwing an error though, it appears that struts just kept revisiting the same original action over and over in a loop. Very wierd!
A bit more detail if people are intersted : typical forward to a jsp :
typical forward to another action:
Well, I combined the two, I gave a web/jsp path to an action like this :
Thanks for input!
This syntax had worked previously even though it was wrong. Confusing!
subject: Can I build in Java1.4 and run on Java1.6