Win a copy of AWS Security this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Error compiling the AdviceClient.java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
thanks David. you're very helpful
Godwin
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic