Topic: 为何用AGLET调用Jpcap时总提示初始化错误?

  Print this page

1.为何用AGLET调用Jpcap时总提示初始化错误? Copy to clipboard
Posted by: liugongquan
Posted on: 2005-07-18 15:53

我想用AGLET调用Jpcap来抓取数据包,但运行时总提示初始化错误,提示 java.security.AccessControlException: access denied (java.lang.R
ntimePermission loadLibrary.jpcap),我在.aglet.policy文件中也做了相应的修改,但还是不能正常运行.请高人为我指点,谢谢.下面是代码和.aglet.policy文件内容:
一:代码
package test;
import java.io.*;
import jpcap.Jpcap;
import com.ibm.aglet.*;
public class FirstAgent extends Aglet {
  public void onCreation(Object o) {
    System.out.println("\n************************");
    System.out.println("running in the onCreation()...");
  }
public void run(){
  String[] dev= Jpcap.getDeviceList();//获取可用以捕包的接口
  System.out.println("Device list is: "+dev);//显示捕包的接口

  }
}

二:.aglet.policy
grant codeBase "atp://*:*/" {
//permission java.security.AllPermission ;
permission com.ibm.aglets.security.MessagePermission "*", "*";
protection com.ibm.aglet.security.MessageProtection "*", "*";
permission java.lang.RuntimePermission "loadLibrary.jpcap";
permission java.lang.RuntimePermission "accessClassInPackage.jpcap.*";
permission java.io.FilePermission "C:\\Program Files\\Java\\-", "read, write, execute";
};


   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