• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

HF EJB compile error

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?


^
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic