• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

class file has wrong version 50.0, should be 49.0

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on Servlets-4a and trying to compile VideoData.java. The compiler is complaining, specifically:

"class file has wrong version 50.0, should be 49.0"

So I know that means the version is for 1.6 when I need 1.5, but my javac version is 1.5.0_12.

What have I done this time?
 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My first guess is that you're compiling with a newer version of java than you're running with.

Try:

java -version
javac -version

Do these give the same value?
 
Ed Connery
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, both give me version 1.5.0_12 (build 1.5.0_12-b04).
 
Greg Charles
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, plus you're getting it at compile time, not run time, so the java runtime version isn't relevant. How exactly are you compiling? Just, "javac VideoData.java", or with along with the other Java files, or through ant?
 
Ed Connery
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good question! I was compiling through ant. Simplifying to javac VideoData.java, the compilation works. Retrying via ant fails, so maybe I was focusing on the wrong part of the error messages. Let's give more complete text:

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you able to compile and run this program without using any IDE?
 
Greg Charles
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, that's confusing. It looks like the error is on VideoServlet.java. VideoData.java has already been compiled, but somehow has the wrong version in it. Have you tried "ant clean"? It's just possible that you have an old class file hanging out there somehow. Also, I believe the JDK version used by ant is going to be what is specified in the JAVA_HOME environment variable. You should make sure that matches up with the version that you'd get from running from a command, that is, the one you get from your path.
 
Ed Connery
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ant clean did the trick! (Now of course I have to get it to WORK now that I can get it to compile. Details, details.)

For future reference, JAVA_HOME does point to the same version.

gyan: No IDE involved here. Just to keep life simple, I have the Cattle Drive with no IDE, a Sun Java course using NetBeans, and a work project using Eclipse. Three different web servers, too. No, I don't know which way is up!
 
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic