aspose file tools*
The moose likes Beginning Java and the fly likes class file has wrong version 50.0, should be 49.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class file has wrong version 50.0, should be 49.0" Watch "class file has wrong version 50.0, should be 49.0" New topic
Author

class file has wrong version 50.0, should be 49.0

Rahul Kesharwani
Greenhorn

Joined: Jun 04, 2012
Posts: 15

Hi,

I am porting my application from jdk 1.5 to jdk 1.6.

While compiling my application in version 1.6, I am getting following error:



======== Rebuilding "MAINMAKE" ========
/vob/xmate99/PMAB/src/XPASMGUI/MainApp.java:36: cannot access XPASerMan
bad class file: /vob/xmate99/PMAB/src/XPASMGUI/gui/XPASerMan.class
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
XPASerMan.getInstance();
^
1 error
*** Error code 1
clearmake: Error: Build script failed for "MAINMAKE"
========================================================


Please help.
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Sounds like you're still using Java 5 to execute the code, not Java 6.
Rahul Kesharwani
Greenhorn

Joined: Jun 04, 2012
Posts: 15

Hi Tim,
For compiling I am using jdk1.6. i have made relevent changes in the "Makefile"

P.S.: We use Makefile to make a build for our application.
It is a clearcase command
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

Check the Java version before you run:

$ java -version

As Tim said, you're probably trying to run the classes you created with a Java 6 compiler in a Java 5 runtime.

(Edit: Darn it, did it again. Second time today I missed a detail in the OP. Bad bartender!)

Ok, so it's the Make that's complaining. I see. Still sounds like you're running the wrong compiler, even though you changed the Make file. So add 'javac -version' in there and see what it outputs, you may find that your assumption that you're compiling with Java 6 is wrong.


Junilu - [How to Ask Questions] [How to Answer Questions]
Rahul Kesharwani
Greenhorn

Joined: Jun 04, 2012
Posts: 15

Junilu Lacar wrote:Check the Java version before you run:

$ java -version

As Tim said, you're probably trying to run the classes you created with a Java 6 compiler in a Java 5 runtime.

(Edit: Darn it, did it again. Second time today I missed a detail in the OP. Bad bartender!)

Ok, so it's the Make that's complaining. I see. Still sounds like you're running the wrong compiler, even though you changed the Make file. So add 'javac -version' in there and see what it outputs, you may find that your assumption that you're compiling with Java 6 is wrong.


Hi Junilu,

There is a slight problem in that.
"java -version" is showing jdk 1.5

My system ( Solaris 5.10) has currently both the versions installed.
The old applications are running on jdk 1.5
However to test the feasability of porting from jdk 1.5 to jdk 1.6, I have made the installation of jdk 1.6 in another directory.

I have made necessary changes in the Makefile to help support my application to run on jdk 1.6 (like, I have changed the location of the "java", "javac" in the Makefile).

Can there be a possibility that, it`s still picking jdk 1.5 insted of 1.6
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4462
    
    6

That's definitely what it looks like is happening. Start by checking the PATH. Then double check the changes made in the make file to make sure your assumptions are correct.

See what 'javac -version' returns when you run make. It will probably be Java 1.5 too.
Rahul Kesharwani
Greenhorn

Joined: Jun 04, 2012
Posts: 15

Hi,

Got the solution.


I was not reffering to the right 'javac' compiler. It was by default taking the environment variable`s path (which was "/usr/bin" in my case..which had by default jdk1.5 installed in that location)

I changed the refrence by

/jdk1.6.0/bin/javac -classpath <------> xyz.java

where "/jdk1.6.0/bin" is the location I installed jdk 1.6

The necessary changes helped me achieve the compilation using Makefile.



Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38896
    
  23
If you look here, you find out about setting paths. You would probably do well to set a path in the .bashrc file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: class file has wrong version 50.0, should be 49.0