如何创建 .jar cild

发布于 2024-10-02 20:03:28 字数 97 浏览 0 评论 0原文

我想做一些类似 Jar cvf file.jar *.class 的事情,但我在 jre6 java 安装中没有看到 jar 编译器文件。这个罐子是我想要罚款并安装的单独的东西吗?

i want to do something like Jar cvf file.jar *.class but i don't see a jar compiler file in my jre6 java install. is the jar something separate i'm suppose to fine and install?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

公布 2024-10-09 20:03:28

您需要下载 JDK。该工具包含在 JDK 中,而不是 JRE 中。

You need to download the JDK. That tools is included on the JDK, not the JRE.

凉薄对峙 2024-10-09 20:03:28

基本步骤是(这只会将您的类文件打包成 jar (~zip) 文件):

  1. 此处 并安装它
  2. 打开终端并进入目录并输入 jar cvf file.jar *.class
  3. 通过 运行 jar 文件java -cp file.jar your.package.MainClass

如果你想让它直接运行(“双击”或java -jar file.jar),那么添加一个清单,如< a href="http://download.oracle.com/javase/tutorial/deployment/jar/appman.html" rel="nofollow">本教程。

The basic steps are (this will only package your class files into a jar (~zip) file):

  1. Download the jdk from here and install it
  2. Open a terminal and go the the directory and type jar cvf file.jar *.class
  3. Run the jar file by java -cp file.jar your.package.MainClass

If you want to make it directly runnable ("double-clickable" or java -jar file.jar) then add a manifest like this tutorial.

陌若浮生 2024-10-09 20:03:28

如果您不需要在 MANIFEST.MF 中放置任何特殊信息,则 jar 文件只是一个 zip 文件,您可以使用任何 zip 工具创建 zip 文件并随后重命名。

If you do not need any special information placed in MANIFEST.MF a jarfile is just a zip file and you can use any zip tool to create the zip file and rename it afterwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文