Topic: 请教J2EE 1。4配置方法

  Print this page

1.请教J2EE 1。4配置方法 Copy to clipboard
Posted by: booolee
Posted on: 2004-07-27 01:35

D:\ejb\Hello\src>javac -d ..\classes *.java
Hello.java:1: package javax.ejb does not exist
public interface Hello extends javax.ejb.EJBObject{
^
Hello.java:2: package javas.rmi does not exist
public String getHello() throws javas.rmi.RemoteException;
^
HelloEJB.java:1: package javax.ejb does not exist
import javax.ejb.*;
^
HelloEJB.java:2: cannot resolve symbol
symbol : class SessionBean
location: class HelloEJB
public class HelloEJB implements SessionBean{
^
HelloEJB.java:15: cannot resolve symbol
symbol : class Sessioncontext
location: class HelloEJB
public void setSessionContext(Sessioncontext ctx){
^
HelloHome.java:1: package javax.ejb does not exist
public interface HelloHome extends javax.ejb.EJBHome{
^
HelloHome.java:4: package javax.ejb does not exist
javax.ejb.CreateException;
^
7 errors

小弟初学,不会配置J2EE 1.4.1,EJB编译不了,程序是参考《实战EJB系列》PDF教程里写的,请高人指点

2.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: why
Posted on: 2004-07-27 10:41

很直接地說﹐如果像
package XXX does not exist
cannot resolve symbol
这类初级问都不能解決﹐
那就暂不要碰J2EE好了
搞好基础的Java功夫,
否则必定必定必定徒劳无功啦。Sad

3.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: booolee
Posted on: 2004-07-27 13:44

说的好,等我看完J2EE手册再来拜访!

4.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: why
Posted on: 2004-07-27 17:28

不是 J2EE手册
而是 Java基础 這一类
因为那两个信息息都显示问题出于classpath
大侠若不知,得从基础下手

5.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: booolee
Posted on: 2004-07-27 17:57

谢谢,why明示
我以前是M$阵营的程序员,现在想转会,基础我想还是有的,why虽然言语直接,但是说的很有道理,先谢谢了,关于j2ee的基础教程我看过一些,但是都是说j2ee低版本的,路径都不相同,所以有迷茫,还好这些都是小问题,关于下面的问题希望why明示,因为也许你简单的提示就可以节约我很多的时间
今天仔细研究了javac命令参数,终于将7个错误减少到了1个错误,这个错误不知道什么意思,也与classpath无关,请why明示

D:\ejb\Hello\src>javac -classpath .;%classpath%;c:\sun\appserver\lib -sourcepath
*.* -d ..\classes
HelloHome.java:2: cannot resolve symbol
symbol : class Hello
location: interface HelloHome
public Hello create() throws java.rmi.RemoteException,javax.ejb.CreateEx
ception;
^
1 error

需要编译的文件有3个,在src目录中,帮我看看到底有什么错误,分别是:

//Hello.java
public interface Hello extends
javax.ejb.EJBObject
{
public String getHello()
throws java.rmi.RemoteException;
}

//HelloEJB.java
import javax.ejb.*;
public class HelloEJB implements SessionBean{
public void ejbCreat(){
}

public void ejbRemove(){
}

public void ejbActivate(){
}

public void ejbPassivate(){
}

public void setSessionContext(SessionContext ctx){
}

public String getHello(){
return new String("Hello,EJB");
}
}

//HelloHome.java
import java.rmi.*;
import javax.ejb.*;

public interface HelloHome
extends EJBHome
{
public Hello create() throws CreateException,RemoteException;
}

6.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: booolee
Posted on: 2004-07-27 19:21

需要编译的文件有3个,在src目录中,帮我看看到底有什么错误,分别是:

//Hello.java
public interface Hello extends
  javax.ejb.EJBObject
{
  public String getHello()
    throws java.rmi.RemoteException;
}

//HelloEJB.java
import javax.ejb.*;
public class HelloEJB implements SessionBean{
  public void ejbCreat(){
  }
  
  public void ejbRemove(){    
  }
  
  public void ejbActivate(){
  }
  
  public void ejbPassivate(){
  }
  
  public void setSessionContext(SessionContext ctx){
  }
  
  public String getHello(){
    return new String("Hello,EJB");
  }
}

//HelloHome.java
import java.rmi.*;
import javax.ejb.*;

public interface HelloHome
  extends EJBHome
{
  public Hello create() throws CreateException,RemoteException;
}

7.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: why
Posted on: 2004-07-28 10:28

1. >>> javac -classpath .;%classpath%;c:\sun\appserver\lib -sourcepath *.* -d ..\classes
Your compiled classes are in ..\classes, but it doesn't seem to be on the classpath

2. use package

3. compile the files in the correct sequence

8.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: booolee
Posted on: 2004-07-28 10:54

D:\ejb\Hello\src>javac -classpath .;%classpath%;c:\sun\appserver\lib;..\classes
-sourcepath *.* -d ..\classes
HelloHome.java:7: cannot resolve symbol
symbol : class Hello
location: interface HelloHome
public Hello create() throws CreateException,RemoteException;
^
1 error

use package????????

thank you answer my question!!

9.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: ww1ww1
Posted on: 2004-07-31 09:47

I think maybe you can check your classpath with the minor java procedure such as helloworld.java.

And I think that you maybe focus your problem on the package setting...

10.Re:请教J2EE 1。4配置方法 [Re: booolee] Copy to clipboard
Posted by: windboy4000
Posted on: 2004-08-01 21:53

你没有ejb包


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923