Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • 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:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Trying to Compile code From "Head First EJB"

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

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 !!!
 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a classpath issue. Make sure that you have right jars in the classpath. For more inforamation how to setup the required .jar files, please read the J2EE tutorial provided by Sun.

Good luck.
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Step 1:Set path(somedrive:\j2sdk1.4.1_03\bin and classpath(up to rt.jar)

Step 2:you should create one standard dirctory structure i.e create your own standard dirctory.

step 3: your working directory>javac -d . *.java

step 4: now compile your jar file with ejbc i.e your workingdirctory>java ejbc jar-file name new jar-file name.

Resule for step 4:ejbc successful.

step 5 eploy new jar-file name into your j2ee complaint application server.
i.e c:\bea\weblogic700\samples\server\config\examples\applications\new jar-file

step 6:Now make a request form browser http:\\localhost:7001\new jar-file name\Welcome.jsp

if you find any error plz feel free to make a mail to me sirish_msc@yahoo.com.

GoodLuck..
G Sirish Reddy.,
 
The only cure for that is hours of television radiation. And this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic