J2SE, J2EE, CLASSPATH

Discussion in 'Java' started by Razvan, Aug 9, 2004.

  1. Razvan

    Razvan Guest

    Hi!





    When I am trying to compile some EJB and I get the error:

    mrazvan@razvan /cygdrive/d/work/java
    $ javac ejb/demo/Demo.java
    ejb/demo/Demo.java:17: package javax.ejb does not exist
    import javax.ejb.*;

    The compiler cannot find the package javax.ejb. I jave correctly
    installed J2SE. Do I need to install J2EE ?
    I know that some people istall both J2SE and J2EE ? Does that
    make any sense ?

    I think that the classpath must be modified. Can somebody tell me
    what the CLASSPATH should be ? (I have Tomcat + Jboss + J2SE + Win32 +
    Cygwin)



    Regards,
    Razvan
     
    Razvan, Aug 9, 2004
    #1
    1. Advertising

  2. Razvan

    Sean Chou Guest

    On 2004-08-09 16:22:28 -0500, (Razvan) said:

    > When I am trying to compile some EJB and I get the error:
    >
    > mrazvan@razvan /cygdrive/d/work/java
    > $ javac ejb/demo/Demo.java
    > ejb/demo/Demo.java:17: package javax.ejb does not exist
    > import javax.ejb.*;


    When compiling, you need the j2ee.jar in your classpath. You can always
    use the one from your app server if you don't have the one from the
    j2ee sdk.

    > The compiler cannot find the package javax.ejb. I jave correctly
    > installed J2SE. Do I need to install J2EE ?
    > I know that some people istall both J2SE and J2EE ? Does that
    > make any sense ?
    >
    > I think that the classpath must be modified. Can somebody tell me
    > what the CLASSPATH should be ? (I have Tomcat + Jboss + J2SE + Win32 +
    > Cygwin)


    You shouldn't have to worry about it at run-time. It should be part of
    JBoss' classpath already.
     
    Sean Chou, Aug 9, 2004
    #2
    1. Advertising

  3. Razvan

    Sudsy Guest

    Razvan wrote:
    <snip>
    > The compiler cannot find the package javax.ejb. I jave correctly
    > installed J2SE. Do I need to install J2EE ?


    No.

    > I know that some people istall both J2SE and J2EE ? Does that
    > make any sense ?


    In certain situations. Not yours.

    > I think that the classpath must be modified. Can somebody tell me
    > what the CLASSPATH should be ? (I have Tomcat + Jboss + J2SE + Win32 +
    > Cygwin)


    In your $JBOSS_HOME/client directory is a file named jboss-j2ee.jar
    which contains what you require. Add it to your CLASSPATH.
     
    Sudsy, Aug 9, 2004
    #3
  4. Razvan

    Razvan Guest

    Indeed, it works if I modify the CLASSPATH like this:

    CLASSPATH=.;D:\jboss-3.2.5\client\jboss-j2ee.jar



    Thanks,
    Razvan
     
    Razvan, Aug 10, 2004
    #4
  5. Razvan

    Razvan Guest

    Sudsy <> wrote in message news:<>...
    > Razvan wrote:
    > <snip>
    > > The compiler cannot find the package javax.ejb. I jave correctly
    > > installed J2SE. Do I need to install J2EE ?

    >
    > No.
    >
    > > I know that some people istall both J2SE and J2EE ? Does that
    > > make any sense ?

    >
    > In certain situations. Not yours.



    When should I do something like that ?


    Regards,
    Razvan
     
    Razvan, Aug 10, 2004
    #5
  6. Razvan

    Sudsy Guest

    Razvan wrote:
    <snip>
    >>> I know that some people istall both J2SE and J2EE ? Does that
    >>>make any sense ?

    >>
    >>In certain situations. Not yours.

    >
    >
    >
    > When should I do something like that ?


    Prime example: when you're developing servlets or EJBs but don't have a
    servlet container or J2EE server on your machine. You'd need access to
    the J2EE jars in order to compile your code.
    As you've seen with JBoss, most containers and J2EE servers include the
    libraries you need. If you have Tomcat 3 installed then the jar is in
    $TOMCAT_HOME/lib/common/servlet.jar. With Tomcat 4 you'll find it in
    $TOMCAT_HOME/common/lib/servlet.jar. It's not a complete J2EE jar: it
    only includes those elements required for writing servlets and JSPs.
    Fair enough?
     
    Sudsy, Aug 10, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    3
    Views:
    7,339
    Tony Morris
    Feb 9, 2004
  2. Gabe
    Replies:
    3
    Views:
    1,093
  3. Martijn Mulder

    J2SE 1.4.2 or J2SE 5.0?

    Martijn Mulder, Jun 27, 2005, in forum: Java
    Replies:
    15
    Views:
    1,860
    Tor Iver Wilhelmsen
    Jun 28, 2005
  4. Replies:
    0
    Views:
    532
  5. Replies:
    2
    Views:
    774
Loading...

Share This Page