• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Error compiling the AdviceClient.java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
put your -classpath around quotes...
-classpath "%CLASSPATH%;blah;blah;blah"
That should fix it right up! :-)
Hope that helps.
-=david=-
 
Kokou Poenou
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks David. you're very helpful
Godwin
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic