Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

getting major.minor 50 error

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am not able to execute even a simple hello world java program!
here is the screen shot of the error
please help me out of this problem
a.png
[Thumbnail for a.png]
 
Sheriff
Posts: 22684
128
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The class has been compiled with a Java 7 compiler (51.0 means Java 7, 50.0 means Java 6), but you are using a version 6 or below JVM.
 
Marshal
Posts: 76468
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to the Ranch

Please try the following commands at the command linePlease check your system PATH; the JDK installation folder ought to be before anything else which might contain the java tool. So it needs to be before Windows and System32 and system 64.
 
Nomesh gajare
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so how should i remove this problem???

the versions are as follows attached in image
a.png
[Thumbnail for a.png]
 
lowercase baba
Posts: 13074
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
don't compile with 7 and run on 6.

You probably have java installed multiple times. what is your PATH variable set to?

Note: there is also a flag you can pass the compiler and say "compile as java 6", but I forget what it is. "javac -help" should tell you.
 
Nomesh gajare
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so how do i compile and execute with same java versions?
please tell me in detail!!!
 
Master Rancher
Posts: 4280
57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Expanding on what Fred and Campbell said:

Your PATH probably has two versions of Java in it, 6 and 7. The Java 6 version occurs first in the path, so it's found first. But it's incomplete - probably it's a JRE rather than a JDK - so while it has a java.exe, it doesn't hava a javac.exe. So when your system looks for java.exe, it finds version 6, but when it looks for javac.exe, it finds version 7.

Preferred solution: edit your PATH to remove references to the Java 6 installation, keeping only the Java 7 info. Or (as Campbell said) just make sure the Java 7 stuff is listed before everything else. It won't matter if there are other versions of Java, as long as your preferred version is listed first in the PATH.

See: How to set or change the PATH system variable.
 
Campbell Ritchie
Marshal
Posts: 76468
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Better to alter the PATH by moving the JDK installation folder to the beginning. There might be JRE6s in system folders, which you don’t want to delete.
 
Mike Simmons
Master Rancher
Posts: 4280
57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, I was updating my comment to reflect that at the same time you were typing.
 
Nomesh gajare
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have shifted the jdk path to first in path but still the problem persists!
the path in my system is configured as in the image
a.png
[Thumbnail for a.png]
 
Mike Simmons
Master Rancher
Posts: 4280
57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks good - I don't know what would be wrong with it, assuming that directory exists exactly as you've written it. Is it possible you are still using the original command window? You need to exit and re-open the window after changing the PATH (or any system variable), in order to see its effect. Other than that, I have no idea. Perhaps a more windows-savvy rancher can help you.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic