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.
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).
SCJP, SCJD, SCWCD, OCPJBCD
Seriously? That's what you're going with? I prefer this tiny ad:
a bit of art, as a gift, the permaculture playing cards