wood burning stoves 2.0*
The moose likes Java in General and the fly likes getting major.minor 50 error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "getting major.minor 50 error" Watch "getting major.minor 50 error" New topic
Author

getting major.minor 50 error

Nomesh gajare
Greenhorn

Joined: Jul 04, 2012
Posts: 7
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


[Thumbnail for a.png]

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36599
    
  16
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

Joined: Jul 04, 2012
Posts: 7
so how should i remove this problem???

the versions are as follows attached in image


[Thumbnail for a.png]

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10929
    
  12

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Nomesh gajare
Greenhorn

Joined: Jul 04, 2012
Posts: 7
so how do i compile and execute with same java versions?
please tell me in detail!!!
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2970
    
    9
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

Joined: Oct 13, 2005
Posts: 36599
    
  16
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

Joined: Mar 05, 2008
Posts: 2970
    
    9
Yeah, I was updating my comment to reflect that at the same time you were typing.
Nomesh gajare
Greenhorn

Joined: Jul 04, 2012
Posts: 7
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


[Thumbnail for a.png]

Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2970
    
    9
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting major.minor 50 error
 
Similar Threads
Getting error in setupConnection()
problem in retreiving value
Regarding tomcat
print statement in the declaration ...
WA #1.....word association