You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ken Bowen <kb...@als.com> on 2009/06/24 20:54:31 UTC

Best practices for switching back/forth between java 1.5/1.6

Hi all,

I failed at searching for this, even though I know it's been answered:
Setting:  Tomcat 6.0_20; Mac OS X 10.5.7;
I've been normally running against java 1.5.0_19, but I tried to  
install a war which is throwing

	.UnsupportedClassVersionError: Bad version number in .class file

when it tries to load.  So clearly I need to run it under java 1.6,  
which is installed, and I know that moving to 1.6 is a good thing.    
However, for a while I'm going to need to switch back and forth  
between 1.5 and 1.6, because at least one customer is stuck at 1.5 for  
the present.   I made a copy of tomcat's bin/startup.sh, renamed it  
sup16.sh, and added these two lines at the top:

JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
export JAVA_HOME

This appears to work well enough -- the new war starts and does it's  
basic thing ok, and when I want to switch up to 1.6 in general, I  
could do the same thing creating a sup15.sh.   So I really only have  
two questions:

1) Are there hidden problems lurking with doing things this way?

2) Is there a better way of being able to switch back & forth?

Thanks in advance,
Ken


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Best practices for switching back/forth between java 1.5/1.6

Posted by Ronald Klop <ro...@base.nl>.
Hi,

Make sure you compile everything with Java 1.5 or javac -target 1.5. That wil run in java 1.5 and 1.6.

Ronald.


Op woensdag, 24 juni 2009 20:54 schreef Ken Bowen  :> 
> Hi all,
> 
> I failed at searching for this, even though I know it's been answered:
> Setting:  Tomcat 6.0_20; Mac OS X 10.5.7;
> I've been normally running against java 1.5.0_19, but I tried to  
> install a war which is throwing
> 
>     .UnsupportedClassVersionError: Bad version number in .class file
> 
> when it tries to load.  So clearly I need to run it under java 1.6,  
> which is installed, and I know that moving to 1.6 is a good thing.    
> However, for a while I'm going to need to switch back and forth  
> between 1.5 and 1.6, because at least one customer is stuck at 1.5 for  
> the present.   I made a copy of tomcat's bin/startup.sh, renamed it  
> sup16.sh, and added these two lines at the top:
> 
> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
> export JAVA_HOME
> 
> This appears to work well enough -- the new war starts and does it's  
> basic thing ok, and when I want to switch up to 1.6 in general, I  
> could do the same thing creating a sup15.sh.   So I really only have  
> two questions:
> 
> 1) Are there hidden problems lurking with doing things this way?
> 
> 2) Is there a better way of being able to switch back & forth?
> 
> Thanks in advance,
> Ken
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
>  
> 
> 
> 

  

RE: Best practices for switching back/forth between java 1.5/1.6

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Andre-John Mas [mailto:ajmas@sympatico.ca]
> Subject: Re: Best practices for switching back/forth between java
> 1.5/1.6
> 
> If this is simply for development purposes, then I would recommend
> having two installations of Tomcat. One is configured to use JDK 1.5
> and the other JDK 1.6. Specify the JAVA_HOME in catalina.sh. There are
> other solutions, but from experience this is the simplest approach.

I have to recommend the opposite - use just one Tomcat version, and definitely do NOT modify catalina.sh (ever).  Just set JAVA_HOME to point to the appropriate JDK when you want to switch.  (If you do want to set any permanent environment variables, do that in setenv.sh, which Tomcat calls automatically at startup if it exists.)

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Best practices for switching back/forth between java 1.5/1.6

Posted by Andre-John Mas <aj...@sympatico.ca>.
On 24-Jun-2009, at 14:54, Ken Bowen wrote:

> Hi all,
>
> I failed at searching for this, even though I know it's been answered:
> Setting:  Tomcat 6.0_20; Mac OS X 10.5.7;
> I've been normally running against java 1.5.0_19, but I tried to  
> install a war which is throwing
>
> 	.UnsupportedClassVersionError: Bad version number in .class file
>
> when it tries to load.  So clearly I need to run it under java 1.6,  
> which is installed, and I know that moving to 1.6 is a good thing.    
> However, for a while I'm going to need to switch back and forth  
> between 1.5 and 1.6, because at least one customer is stuck at 1.5  
> for the present.   I made a copy of tomcat's bin/startup.sh, renamed  
> it sup16.sh, and added these two lines at the top:
>
> JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/ 
> Home
> export JAVA_HOME
>
> This appears to work well enough -- the new war starts and does it's  
> basic thing ok, and when I want to switch up to 1.6 in general, I  
> could do the same thing creating a sup15.sh.   So I really only have  
> two questions:
>
> 1) Are there hidden problems lurking with doing things this way?
>
> 2) Is there a better way of being able to switch back & forth?

If this is simply for development purposes, then I would recommend  
having two installations of Tomcat. One is configured to use JDK 1.5  
and the other JDK 1.6. Specify the JAVA_HOME in catalina.sh. There are  
other solutions, but from experience this is the simplest approach.

Andre

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org