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 in compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "error in compilation" Watch "error in compilation" New topic
Author

error in compilation

sonali rao
Ranch Hand

Joined: Nov 03, 2003
Posts: 64
Hi
I am trying to implement the example given in the 1st chap of HF EJB book.
I compiled the Advice.java & AdviceBean.java successfully.
I am unable to compile AdviceHome.java. I get the following error.

Cannot resolve symbol
Symbol: class Advice
location: public Advice create() throws CreateException, RemoteException
The problem is it is unable to recognise Interface Advice though all the interfaces and classes are present in the same directory. I am using windows xp and trying to compile from MS-DOS prompt.
I tried all sorts of things like putting the dir which contains the classes in the classpath etc but it dint work out
Please let me know how to correct this problem.
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
Originally posted by sonali rao:
The problem is it is unable to recognise Interface Advice though all the interfaces and classes are present in the same directory.

This is usually because of package/directory mismatch. Maybe if you ran the compile with explicit -classpath and -sourcepath you could make some headway. You might make a batch file so you can be more productive with your experimentation.
Here's a paste of my compileClient.bat:
C:\EJBBook\projects\advice>type compileClient.bat
cd \ejbbook\projects\advice
rem javac
rem -classpath
rem c:\j2sdkee1.3.1\lib\j2ee.jar;
rem c:\ejbbook\projects\advice\AdviceAppClient.jar
rem AdviceClient.java
javac -classpath c:\j2sdkee1.3.1\lib\j2ee.jar;c:\ejbbook\projects\advice\AdviceA
ppClient.jar AdviceClient.java
pause

C:\EJBBook\projects\advice>
Abbu Rahman
Ranch Hand

Joined: Jan 05, 2004
Posts: 46
Originally posted by Dale Seng:

javac -classpath c:\j2sdkee1.3.1\lib\j2ee.jar;c:\ejbbook\projects\advice\AdviceA
ppClient.jar AdviceClient.java

well I have the same problem here , but you have shown how to compile AdviceClient.java ... but here we want to compile AdviceHome.java
correct sonali ???
Abbu Rahman
Ranch Hand

Joined: Jan 05, 2004
Posts: 46
Try this
(till some Sagacious soul helps us out )
remove package statements from all 3 java files.
go to evnironment variable and put this for CLASSPATH = C:\java\j2sdkee1.3.1\lib\j2ee.jar;.
ie place a dot at the end .
come back and compile all 3 java file.
Mylene Reiners
Greenhorn

Joined: Apr 08, 2004
Posts: 7
I managed to compile (and everything else) using the directions given in the book... using the headfirst package:
D:\projects\advice\src>javac -d ../classes headfirst/*.java
What's the problem with that? - you won't get dependency errors
Mylene
Abbu Rahman
Ranch Hand

Joined: Jan 05, 2004
Posts: 46
Originally posted by Mylene Reiners:
using the directions given in the book...


page number plz .
Jeff Pavlocak
Greenhorn

Joined: Apr 26, 2004
Posts: 16
I had some problems getting this to compile and run also. However, I did get it to compile and run under Windows. Here are my environment settings and command line statements. I hope you find this helpful.
Java installation: j2sdk_nb (NetBeans IDE)
Environment variables:
JAVA_HOME = C:\j2sdk_nb\j2sdk1.4.2
J2EE_HOME = C:\j2sdkee1.3.1
CLASSPATH = %JAVA_HOME%\bin;%J2EE_HOME\bin%;.
Change the getAdvice method in the AdviceBean and Advice interface to be getMessage instead. Pages 18 and 19.
Bean and Interface compile line Page 30:
javac -classpath %CLASSPATH%;%J2EE_HOME%\LIB\j2ee.jar -d ..\classes\headfirst\*.java
This should be all one line, not two. Notice the j2ee.jar in the classpath
After you finish the steps in the deploytool pages 32 - 54, write and compile your client app. Make sure you use call the getMessage method instead of the getAdvice method Page 57.
AdviceClient compile line Page 57:
javac -classpath %CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar;AdviceAppClient.jar AdviceClient.java
Once again, one line not two.
AdviceClient run line Page 58:
java -cp %CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar;AdviceAppClient.jar AdviceClient
Again, one line.
I hope this helps anyone having problems in a Windows DOS shell.
jpp
Jeff Pavlocak
Greenhorn

Joined: Apr 26, 2004
Posts: 16
Please excuse my previous post where I stipulated one line instead of two. The was my first post and the editor had wrapped the lines. I didn't realize that they would be intact as one line once posted.
jpp
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error in compilation