• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

class file has wrong version 50.0, should be 49.0

 
Greenhorn
Posts: 15
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 7355
170
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 17007
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 17007
298
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.



 
Marshal
Posts: 75842
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic