File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Error compiling the AdviceClient.java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Error compiling the AdviceClient.java" Watch "Error compiling the AdviceClient.java" New topic
Author

Error compiling the AdviceClient.java

Kokou Poenou
Greenhorn

Joined: Jan 06, 2004
Posts: 3
I'm using the Head First EJB book. I want to compile AdviceClient.java to access the AdviceBean. the jar file for the example can be found at
http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBIndex.html
Can somebody tell why i'm getting the following error ?
********************************************************************
C:\projects\advice>javac -classpath {$CLASSPATH}:AdviceAppClient.jar AdviceClient.java
AdviceClient.java:4: package javax.ejb does not exist
import javax.ejb.*;
^
AdviceClient.java:5: package headfirst does not exist
import headfirst.*;
^
AdviceClient.java:25: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narr
ow(o, AdviceHome.class);
^
AdviceClient.java:25: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narr
ow(o, AdviceHome.class);
^
AdviceClient.java:25: cannot resolve symbol
symbol : class AdviceHome
location: class AdviceClient
AdviceHome home = (AdviceHome) PortableRemoteObject.narr
ow(o, AdviceHome.class);
^
AdviceClient.java:27: cannot resolve symbol
symbol : class Advice
location: class AdviceClient
Advice advisor = home.create();
^
6 errors
********************************************************************
My classpath is set as followed:
c:\j2sdkee1.3.1\lib\j2ee.jar;
c:\j2sdkee1.3.1\lib\j2eetools.jar;
c:\j2sdkee1.3.1\lib\jhall.jar;
c:\j2sdkee1.3.1\lib\j2ee-ri-svc.jar;
c:\j2sdkee1.3.1\lib\ejb10deployment.jar

Thanks
David Harrigan
Ranch Hand

Joined: Sep 16, 2003
Posts: 43
Hi,
You're on a DOS/Windows system, therefore your CLASSPATH variable is incorrect.
It should be
%CLASSPATH%
and not
{$CLASSPATH} (even this is incorrect, probably a typo, should be ${CLASSPATH}).
Type
echo %CLASSPATH%
at the cmd prompt to see if you have it correctly set, and paste it here if you still have problems.
So, the DOS equivalent is something like:
javac -classpath %CLASSPATH%;AdviceAppClient.jar AdviceClient.java
(notice the ; after the CLASSPATH - another DOS change from UNIX).
-=david=-
[ January 06, 2004: Message edited by: David Harrigan ]
Kokou Poenou
Greenhorn

Joined: Jan 06, 2004
Posts: 3
Thanks for your response.
I'm still having the problem, but the message is different now.
***************************************************************************
C:\projects\advice>javac -classpath %CLASSPATH%;AdviceAppClient.jar AdviceClient
.java
javac: invalid flag: Files\Altova\xmlspy\XMLSpyInterface.jar;c:\j2sdk1.4.2_03\bin;.;c:\j2sdk1.4.2_03\jre\bin;AdviceAppClient.jar
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
***************************************************************************
The result of my echo command is:
***************************************************************************
C:\projects\advice>echo %CLASSPATH%
C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;c:\j2sdk1.4.2_03\bin;.;c:\j2sdk1.4.2_03\jre\bin
***************************************************************************
I'm using Microsoft Windows XP [Version 5.1.2600]

Thanks
David Harrigan
Ranch Hand

Joined: Sep 16, 2003
Posts: 43
Hi,
put your -classpath around quotes...
-classpath "%CLASSPATH%;blah;blah;blah"
That should fix it right up! :-)
Hope that helps.
-=david=-
Kokou Poenou
Greenhorn

Joined: Jan 06, 2004
Posts: 3
thanks David. you're very helpful
Godwin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error compiling the AdviceClient.java
 
Similar Threads
Error in compiling Advice Client in ejb
Getting compile error for AdviceClient.java from Head First EJB
problem on hfejsb page 57
head first ejb pg:57 client problem!!!please help urgent
help!: AdviceClient.java does not compile