Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The class(headfirst\Advice.class) couldnot be loaded

 
Raghda Ismail
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi every body ,
I just started studying for SCBCD and i use EJB headfirst book

I downloaded and installed :
j2sdkee1.3.1 in c:\j2sdkee1.3.1
j2sdk1.4.2_12 in c:\j2sdk1.4.2_12

i set environment variables:
JAVA_HOME to c:\j2sdk1.4.2_12
J2EE_HOME to C:\j2sdkee1.3.1
Path to %J2EE_HOME%\bin;%JAVA_HOME%\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;

I compiled the classes successfully
I ran j2ee -verbose and started the server
I ran deploytool command and the tool started
I created new application called AdviceApp (as said by the book)
But the problem is when i tried to create EnterpriseBean ,when i reached the step of putting my classes in the jar i got this error

The class(headfirst\Advice.class) could not be loaded
java.lang.UnsupportedClassVersionError :headfirst/Advice (Unsupported major.minor version 50.0)
please consult online help for assistance in setting up the class root directory and choosing class files.

Please i need help here
Thanks in advance
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just started studying for SCBCD and i use EJB headfirst book

Are you aware that this book if for SCBCD1.3 (EJB2.x) ? This will not be enough for SCBCD5.0 (EJB3.0).
 
Raghda Ismail
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe ,
Thanks for your note.
Actually i did not know that ,so if you could refer to another book i would be thankful.
But i think i still need to solve this problem here.

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you compile your class at the command line ? If so, what do you get when you type "javac --version" ?
 
Raghda Ismail
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Chritpohei ,
Thanks for your help.
This was my problem ,i was compiling my classes used jdk 1.6
When i compiled using 1.4.2 things went fine


 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Your problem is the java version. your classes are compiled with a java version and the container expect an other. Even more, I see that you use glassfish, as far as I know the you must set the java home right before you install it otherwise it takes some default one (which are not desirable).
I had a similar problem, i install glassfish without to care about the JAVA_HOME and the glassfish was using the default java (5 on my machine), unfortunately the some of my beans was complied with java 6. To solve the problem I reinstall the glassfish and beore the install (ant) script runs I set the JAVA_HOME to the right java version (1.6).


Regards,
Mihai
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic