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

AdviceClient Compile Error

 
Phirun Phung
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry if I ask a stupid question. I am new for EJB and J2EE. I have spend almost 6 months on this topics but still confused. I try to run an example in Head First EJB and hope it helps me to solve my confusion. I have downloaded the sample code (Advice guy bean) and follow step by step. Everything went well until the last two final steps. It kept showing the error.

I type to Dos Command line
H:\projects\Advice>javac -classpath {$CLASSPATH}:AdviceAppClient.jar AdviceClient.java
AdviceClient.java:4: package headfirst does not exist
import headfirst.*;
^
AdviceClient.java:5: package javax.ejb does not exist
import javax.ejb.*;
^
AdviceClient.java:19: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,AdviceHo
me.class);
^
AdviceClient.java:19: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,AdviceHo
me.class);
^
AdviceClient.java:19: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,AdviceHo
me.class);
^
AdviceClient.java:20: cannot resolve symbol
symbol : class Advice
location: class AdviceClient
Advice advisor = home.create();
^
6 errors
then I just put AdviceClient.class directly to the same directory as AdviceAppClient.jar
and run
H:\projects\Advice>java -cp {$CLASSPATH}:AdviceAppClient.jar AdviceClient
Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient
What have I done incorrectly?
Please help me!
 
Alfred Harre
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks lord, I am not the only one stuck on this problem and this is driving me crazy.
You might wana see my thread HFEJB AdviceClient.java Compilation Error started just few hours before your this thread

Long story in short, command given in book is good for Linux. But for windows, you have to change it to
javac -classpath "{$CLASSPATH};AdviceAppClient.jar" AdviceClient.java
or try this
javac -classpath "%CLASSPATH%;AdviceAppClient.jar" AdviceClient.java
(Please note ; (semicolon) instead of a colon( : ) , qutoes, and %)
With this change I am amble to compile but stuck at running the example.
[ May 03, 2004: Message edited by: Alfred Harre ]
 
Phirun Phung
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much! Alfred. It works now. You just save my life. I stuck to this poing almost 2 days.
Thanks again!
 
Sam In
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alfred
I have some problem .Can u helpme out plz look at this link
::
http://www.coderanch.com/t/159249/java-EJB-SCBCD/certification/run-ee-Server
Thanks
Sam
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic