Results 1 to 4 of 4
  1. #1
    qrac is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default javac can't find javax.ejb...

    Hi,

    I am trying to compile the example from the following tutorial: java.sun.com/j2se/1.4.2/docs/guide/rmi-iiop/interop - Enterprise JavaBeans Components and CORBA Clients: A Developer Guide

    but when running(in windows) javac command with specified class path of my sdk I am getting error saying that the package javax.ejb... does't exist? I was trying to run with jee 1.4 (since the ejb ar of 2.1 standar) and with 1.6 but I get the same result. I was trying to run it as well against the jee included in the jboss(since I have found somewhere information that sdk jee doesn’t contain ejb.jar) but the result is same, please help me!

    Thx in advance for help!

    qrac
    Last edited by qrac; 07-30-2009 at 07:17 PM. Reason: typo

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    765
    Rep Power
    6

    Default

    Check ur class path whether needed jars or added or not
    Ramya:cool:

  3. #3
    qrac is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    Thx, for your reply.
    I am executing following command from the command prompt in Vista from folder containing my .java files :
    javac -classpath C:\sun\SDK\lib\j2ee.jar:...*.java

    and in result I get:


    Java Code:
     Directory of C:\Users\Tomek\workspace\ejbinterop
    
    2009-07-30  15:48    <DIR>          .
    2009-07-30  15:48    <DIR>          ..
    2009-07-30  15:47               411 Logger.java
    2009-07-30  15:48               719 LoggerEJB.java
    2009-07-30  15:48               267 LoggerHome.java
    2009-07-30  15:48             1 047 LogMessage.java
                   4 File(s)          2 444 bytes
                   2 Dir(s)  49 081 012 224 bytes free
    
    C:\Users\Tomek\workspace\ejbinterop>javac -classpath C:\Sun\SDK\lib\j2ee.jar:.. *.java
    Logger.java:4: package javax.ejb does not exist
    import javax.ejb.EJBObject;
                    ^
    Logger.java:11: cannot find symbol
    symbol: class EJBObject
    public interface Logger extends EJBObject
                                    ^
    LoggerEJB.java:4: package javax.ejb does not exist
    import javax.ejb.*;
    ^
    LoggerEJB.java:13: cannot find symbol
    symbol: class SessionBean
    public class LoggerEJB implements SessionBean {
                                      ^
    LoggerEJB.java:20: cannot find symbol
    symbol  : class SessionContext
    location: class ejbinterop.LoggerEJB
        public void setSessionContext(SessionContext sc) {}
                                      ^
    LoggerHome.java:5: package javax.ejb does not exist
    import javax.ejb.EJBHome;
                    ^
    LoggerHome.java:6: package javax.ejb does not exist
    import javax.ejb.CreateException;
                    ^
    LoggerHome.java:8: cannot find symbol
    symbol: class EJBHome
    public interface LoggerHome extends EJBHome
                                        ^
    LoggerHome.java:10: cannot find symbol
    symbol  : class CreateException
    location: interface ejbinterop.LoggerHome
        Logger create() throws RemoteException, CreateException;
                                                ^
    9 errors
    
    C:\Users\Tomek\workspace\ejbinterop>javac -classpath D:\jboss-4.0.0\server\all\lib\jboss-j2ee.jar:.. *.java
    Logger.java:4: package javax.ejb does not exist
    import javax.ejb.EJBObject;
                    ^
    Logger.java:11: cannot find symbol
    symbol: class EJBObject
    public interface Logger extends EJBObject
                                    ^
    LoggerEJB.java:4: package javax.ejb does not exist
    import javax.ejb.*;
    ^
    LoggerEJB.java:13: cannot find symbol
    symbol: class SessionBean
    public class LoggerEJB implements SessionBean {
                                      ^
    LoggerEJB.java:20: cannot find symbol
    symbol  : class SessionContext
    location: class ejbinterop.LoggerEJB
        public void setSessionContext(SessionContext sc) {}
                                      ^
    LoggerHome.java:5: package javax.ejb does not exist
    import javax.ejb.EJBHome;
                    ^
    LoggerHome.java:6: package javax.ejb does not exist
    import javax.ejb.CreateException;
                    ^
    LoggerHome.java:8: cannot find symbol
    symbol: class EJBHome
    public interface LoggerHome extends EJBHome
                                        ^
    LoggerHome.java:10: cannot find symbol
    symbol  : class CreateException
    location: interface ejbinterop.LoggerHome
        Logger create() throws RemoteException, CreateException;
                                                ^
    Can any one help me I am trying to compile this s*** for last two days!!

    C:\Sun\SDK\lib contains j2ee.jar and the javaee.jar and
    D:\jboss-4.0.0\server\all\lib contains jboss-j2ee.jar as well.

    What I am doing wrong??

  4. #4
    qrac is offline Member
    Join Date
    Jul 2009
    Posts
    3
    Rep Power
    0

    Default

    I managed to find solution.
    Except of specyfying the classpath to the j2ee.jar the javaee.jar has to be specified as well, since the later one contains ejb components and the former one contains just references. so we get:
    javac -cp %J2EE_HOME%/lib/j2ee.jar;%J2EE_HOME%/lib/javaee.jar *.java

Similar Threads

  1. javax.microedition.io/ javax.bluetooth
    By ahtiven in forum New To Java
    Replies: 3
    Last Post: 01-13-2009, 02:54 PM
  2. javac?
    By sardare in forum Eclipse
    Replies: 1
    Last Post: 06-14-2008, 02:06 AM
  3. Replies: 1
    Last Post: 08-07-2007, 03:47 PM
  4. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 07:02 PM
  5. Help with javaC
    By Daniel in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 02:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •