class file has wrong version 50.0, should be 49.0

ant  compile error

 cannot access com.microsoft.sqlserver.jdbc.SQLServerDataSource
    [javac] bad class file: C:\V3Project\public_html\WEB-INF\lib\sqljdbc.jar(com/microsoft/sqlserver/jdbc/SQLServerDataSource.class)
    [javac] class file has wrong version 50.0, should be 49.0
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac] import com.microsoft.sqlserver.jdbc.SQLServerDataSource;

sqljdbc.jar  is a SQL Server 2008 driver

How to fix this ?


I have my computer>environment variabe > JAVA_HOME => 1.5 version

Ant compile command

<javac encoding="UTF-8" fork="true"  srcdir="src"   destdir="${Deployment_Dir}/WEB-INF/classes"       
			memoryinitialsize="256m"       memorymaximumsize="256m">
			<classpath refid="some.class.path"/>
			
</javac>

Open in new window

cofactorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CPColinSenior Java ArchitectCommented:
That error means that JAR will work with Java 6 and newer only. Java 5 won't be able to use it. Upgrade to Java 6, 7, or 8 (preferably 8) and the error should go away.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cofactorAuthor Commented:
I have updated java to java 1.6 now

cmd> java -version

java version "1.6.0_30"
Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

But still the same issue

cannot access com.microsoft.sqlserver.jdbc.SQLServerDataSource
    [javac] bad class file: C:\V3Project\public_html\WEB-INF\lib\sqljdbc.jar(com/microsoft/sqlserver/jdbc/SQLServerDataSource.class)
    [javac] class file has wrong version 50.0, should be 49.0
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac] import com.microsoft.sqlserver.jdbc.SQLServerDataSource;

Open in new window

cofactorAuthor Commented:
issue resolved.  had to change to run time JRE to  java 1.6  in Tomcat
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.