easily add files to META-INF in NetBeans

本文介绍了一种在NetBeans中为独立Java应用添加META-INF文件的简便方法,避免了修改构建脚本,适合日常开发使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://georgeinfo.blog.163.com/blog/static/16368334120101019104044650/

————————————————————————————————————————————————————————————

These days when you find me working in Java, you’ll find me working in NetBeans. If I wanted to spend my time manually editing ant scripts, you’d probably find me working in vi instead.

I needed to add a file to META-INF in my application jar a few days ago. NetBeans provides a META-INF folder in the project window for web applications, but not for standalone java applications. There is a lot of documentation for this specific problem that will help you edit your build script to get this done but for something so basic I prefer a simpler solution.

After some experimentation I found an alternative:

  1. open the project window
  2. right-click on “Source Package”, click “New”, and choose “Folder” under the “Other” category
  3. name the new folder “META-INF”
  4. add files (.mailcap in my case) to this folder
  5. build as usual
  6. open your jar, browse to META-INF, and note that your files are now where they belong

 

Please note that I’m using NetBeans 6.5, and that this method could suddenly stop working in some future version of NetBeans if the build process changes dramatically.

If you have an alternative to this process that does not require build script modification, I would very much like to hear from you!

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值