java 如何在ubuntu中从命令行制作jar文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17957602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-01 19:43:13  来源:igfitidea点击:

how to make jar file from commandline in ubuntu

javajarexecutable-jar

提问by frazman

I am kinda stuck. Usually I use the export option in eclipse to create a jar. But now, i have deployed my code in production and want to create a jar file.

我有点卡住了。通常我在eclipse中使用export选项来创建一个jar。但是现在,我已经在生产中部署了我的代码并想要创建一个 jar 文件。

So I have two files,

所以我有两个文件,

 foo.java which calls bar.java

And then it uses couple of jars

然后它使用几个罐子

foobar.jar foo_bar.jar

Now,so main is in foo.java

现在,主要在 foo.java 中

How do i create an executable jar.

我如何创建一个可执行的 jar。

Thanks,

谢谢,

回答by Mark T

Here's a great article on the topic: http://manpages.ubuntu.com/manpages/dapper/man1/jar.kaffe.1.html

这是关于该主题的精彩文章:http: //manpages.ubuntu.com/manpages/dapper/man1/jar.kaffe.1.html

Basically:

基本上:

 $jar cvf classes.jar Foo.class Bar.class