eclipse打包jar,引用外部jar

来源:互联网 发布:姚明nba全明星赛数据 编辑:程序博客网 时间:2024/05/29 02:10

1、正常打成jar包

2、修改jar包中的MANIFEST.MF文件,添加Class-Path: lib/xxx.jar lib/xxx.jar,Class-Path: 后边有一个空格

3、在存放jar包的目录下创建lib文件夹,将引用的xxx.jar等jar包拷贝进去即可

 

=========================================================

jar包引用properties文件

String proFilePath = System.getProperty("user.dir") + "\\config.properties"; 
     ResourceBundle bundle = null;
  try {
   InputStream in = new BufferedInputStream(new FileInputStream(proFilePath)); 
   bundle = new PropertyResourceBundle(in);
  } catch (IOException e) {
   e.printStackTrace();
  }

 

linux下需把配置文件放到调用者同级目录

原创粉丝点击