简体   繁体   English

IntelliJ:.jar文件中的.java和.class文件

[英]IntelliJ: .java and .class files in .jar file

I want to export a java project to send it to a friend (AS JAR FILE). 我想导出一个Java项目以将其发送给朋友(AS JAR FILE)。 He should be able to open the jar file via writing .zip right after the .jar file extension and should see the .java and the .class files. 他应该能够通过在.jar文件扩展名之后立即编写.zip来打开jar文件,并且应该可以看到.java和.class文件。 I managed to export a jar-File as described here 我设法按此处所述导出jar文件

BUT: if I try to get the .java files by writing .zip right after the .jar file extension, there are .class files in the jar-archive only. 但是:如果我尝试通过在.jar文件扩展名后立即编写.zip来获取.java文件,则仅jar归档文件中存在.class文件。

My question: how to automatically create the jar file in intelliJ with .class AND .java files in it? 我的问题:如何在具有.class和.java文件的intelliJ中自动创建jar文件?

You can't export source and compiled project into one file. 您不能将源代码和已编译的项目导出到一个文件中。 But you can just export the project to *.jar and then go to <drive>:/Users/<user>/IdeaProjects/<project>/src and add all those files into archive and also add that exported jar file into that archive. 但是您可以仅将项目导出到* .jar,然后转到<drive>:/Users/<user>/IdeaProjects/<project>/src并将所有这些文件添加到存档中,并将导出的jar文件添加到该存档中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM