问题描述
我正试图从我正在编写的一个小型库中生成一个JAR文件.我了解我需要添加 自定义运行/调试配置 来实现.因此,我添加了这个新的 JAR Application 配置:
I'm trying to generate a JAR file out of a small library I'm writing. I understand that I need to add a custom Run/Debug Configuration to achieve that. So, I added this new JAR Application configuration:
使用此配置运行模块时,出现此错误:
When I run the module with this configuration, I get this error:
"C:\Program Files\Java\jdk1.7.0_79\jre\bin\java" -Dfile.encoding=windows-1256 -jar ""
Error: Unable to access jarfile
Process finished with exit code 1
我不确定为什么,但是我认为这与屏幕截图底部的警告有关,我无法弄清楚为什么会有它.
I'm not sure why, but I think it has something to do with the warning in the bottom of the screenshot, which I can't figure out why I have it.
推荐答案
经过越来越多的研究,似乎发现工件是在智能IDEA中构建JAR文件的方式.
After more and more research, It seams that Artifacts are the way to build JAR files in intelliJ IDEA.
- 文件|项目结构工件.
- 新工件-> JAR->来自具有依赖项的模块
- 选择lib模块,然后单击确定"
- 当您想生成JAR时: Build |构建工件| 工件名称"
- File | Project Structure | Artifacts.
- New Artifact -> JAR -> From modules with dependencies
- Select the lib module, then click Ok
- And when you want to generate the JAR: Build | Build artifacts | "artifact name"
这篇关于使用IntelliJ 14构建JAR文件:无法访问jarfile?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!