• Post Reply Bookmark Topic Watch Topic
  • New Topic

HF EJB compile error  RSS feed

 
Karina Guenther
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - I'm doing the Head First EJB book and am getting the following error when I go to compile from the command line like it wants:


C:\My_Programs\EJBClass\Advice\src\headfirst>javac advice.java
advice.java:4: package javax.ejb does not exist
import javax.ejb.*;
^
advice.java:11: cannot find symbol
symbol: class EJBObject
public interface Advice extends EJBObject

It does build in the Netbeans IDE - however the book would prefer that I not use the IDE so that I learn the nuts and bolts of everything 1st.

So - what's wrong in my setup?


^
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're missing the EJB classes in your classpath. You need to do something like "javac -classpath XYZ.jar advice.java", where XYZ.jar is the file that contains the EJB classes. Check your EJB container, it should include it.
 
Karina Guenther
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this what you were talking about? If so - it still doesn't work.

C:\My_Programs\EJBClass\Advice\src>javac -d ../classes headfirst/*.java

So, Where do the EJB classes exist? I've been looking for them and my path is

C:\My_Programs\EJBClass\Advice>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\Sun\AppServer\bin;C:\Program Files\Java\jdk1.5.0_06\bin

Did I miss downloading something?
I have JAVA_HOME set to...C:\Program Files\Java\jdk1.5.0_06
and J2EE_HOME set to... C:\Sun\AppServer

Could I be running into a version conflict?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "-d" switch merely tells the compiler where to put the class files, it has nothing to do with the "-classpath" switch that telli si where to look for additional classes.

Look through the jar files in the C:\Sun\AppServer directory - somewhere in there you should find the required jar file.

Also, you could download the class files from this page.
[ January 04, 2007: Message edited by: Ulf Dittmer ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!