• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

class file has wrong version 50.0, should be 49.0

 
Rahul Kesharwani
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 2747
38
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you're still using Java 5 to execute the code, not Java 6.
 
Rahul Kesharwani
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rahul Kesharwani
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look here, you find out about setting paths. You would probably do well to set a path in the .bashrc file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic