• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting major.minor 50 error

 
Nomesh gajare
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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]
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 48935
60
  • Mark post as helpful
  • send pies
  • 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
  • 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]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12123
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
so how do i compile and execute with same java versions?
please tell me in detail!!!
 
Mike Simmons
Ranch Hand
Posts: 3076
14
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 48935
60
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 3076
14
  • Mark post as helpful
  • send pies
  • 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
  • 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
Ranch Hand
Posts: 3076
14
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic