The moose likes Java in General and the fly likes Approaches To Solving UnsupportedClassVersionError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Approaches To Solving UnsupportedClassVersionError" Watch "Approaches To Solving UnsupportedClassVersionError" New topic

Approaches To Solving UnsupportedClassVersionError

Marcus Hathaway
Ranch Hand

Joined: Jun 07, 2005
Posts: 89
Hi all,

After uploading my web application to my hosting company, i'm receiving an UnsupportedClassVersionError. I'm figuring this is because i've compiled my classes using JDK 1.5.0_06 whilst the JVM running in my host's server is the older 1.4.2_08. Obviously, if this was on my own machine i would just update the JVM. I'm not sure how keen my host will be though to do the same. Therefore, i was wondering if there are any other approaches to solve this problem. Obviously i could change my JDK to 1.4.2 and recompile but this somehow seems to be unsatisfactory...although i will do it if its the only solution. After reading a similar post from a couple of years back, someone replied with using switches. What are these and how do you use them? Any other comments would be greatly appreciated.

Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
I haven't experimented with this, but there is a compiler switch -source that will allow you to specify a source to use when compiling.
Mark Van Tuyl
Ranch Hand

Joined: Mar 22, 2002
Posts: 60
You can recompile your program like this:

javac -source 1.4 -target 1.4

<a href="" target="_blank" rel="nofollow">How To Ask Smart Questions</a>
I agree. Here's the link:
subject: Approaches To Solving UnsupportedClassVersionError
It's not a secret anymore!