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.
解决方案
After more and more research, It seams that Artifacts are the way to build JAR files in intelliJ IDEA.
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"