This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I bought the book "Head First EJB". I am trying to compile the code on page 18 and 19. I took the following steps BEFORE I tried compiling the code.
Step 1: Downloaded and installed j2sdk1.4.2_08 at "C Root" or "C:\" Step 2: Added "C:\j2sdk1.4.2_08\bin" to the "Path" environment variable. Step 3: Downloaded and installed j2sdkee1.3.1 at "C Root" or "C:\" Step 4: Added "C:\j2sdkee1.3.1\bin" to the "Path" environment variable. Steb 5: Added JAVA_HOME with the value of "C:\j2sdk1.4.2_08" to Env. Var. Step 6: Added J2EE_HOME with the value of "C:\j2sdkee1.3.1" to Env. Var. Step 7: I created the directory structure as stated in the book but (projects\advice\src\headfirst) customised to my computer as follows: The directory is C:\AtHome\At_Training\Java\Books\HeadFirstEJB\projects\advice\src\headfirst Also ... C:\AtHome\At_Training\Java\Books\HeadFirstEJB\projects\advice\classes Step 8: I copied the files "Advice.java", "AdviceBean.Java", "AdviceHome.Java" under the headfirst folder as indicated in the book on page 29 Step 9: I open a dos prompt window. Step 10: I type "cd C:\AtHome\At_Training\Java\Books\HeadFirstEJB\projects\advice\src" as indicated on page 30 of the book. Step 11: On the next line, I type "javac -d ..\classes headfirst\*.java" and press return.
RESLUT: I get the following:
headfirst\Advice.java:3: package javax.ejb does not exist import javax.ejb.*; ^ headfirst\Advice.java:6: cannot resolve symbol symbol : class EJBObject location: interface headfirst.Advice public interface Advice extends EJBObject ^ headfirst\AdviceBean.java:3: package javax.ejb does not exist import javax.ejb.*; ^ headfirst\AdviceBean.java:5: cannot resolve symbol symbol : class SessionBean location: class headfirst.AdviceBean public class AdviceBean implements SessionBean ^ headfirst\AdviceBean.java:28: cannot resolve symbol symbol : class SessionContext location: class headfirst.AdviceBean public void setSessionContext(SessionContext ctx) ^ headfirst\AdviceHome.java:3: package javax.ejb does not exist import javax.ejb.*; ^ headfirst\AdviceHome.java:6: cannot resolve symbol symbol : class EJBHome location: interface headfirst.AdviceHome public interface AdviceHome extends EJBHome ^ headfirst\AdviceHome.java:8: cannot resolve symbol symbol : class CreateException location: interface headfirst.AdviceHome public Advice create() throws CreateException, RemoteException; ^ 8 errors
Can some one tell me what I am doing wrong. At this point the three files ("Advice.java", "AdviceBean.Java", "AdviceHome.Java") should have compiled and should have moved under the classes folder. But it seems that the compiler is not able to find the java packeges. But this should not be so ... because of the environment variables.
Maybe there is something else wrong ... but I can't figure out what. If you have read this book or know the answer then can you tell me what I am doing wrong. PLEASE HELP !!!