如何从.java创建JAR [英] How do I make a JAR from a .java

查看:114
本文介绍了如何从.java创建JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java应用程序编写一个简单的程序(不是具有项目的应用程序,而是项目中的应用程序; .java),它具有单个框架。这两个文件都是.java,因此我无法编写JAR所需的清单。 MyApp.java就像一个带包的类,然后导入公共类MyApp {并且有一个main函数,但它仍然是.java!如果它有帮助我在JDeveloper 11g中写它...

I was writing a simple program using a Java application (not application that has projects, but application within a project; .java) that has a single frame. Both of the files are .java so I can't write a manifest needed by the JAR. The MyApp.java starts like a class with package, imports then public class MyApp { and has a main function, but it's still .java! I'm writing it in JDeveloper 11g if it helps...

如何从这些文件制作JAR?

Any ideas how to make a JAR from these files?

推荐答案

打开命令提示符。

转到目录你有你的.java文件

Go to the directory where you have your .java files

创建一个目录版本

从命令行运行java编译

Run java compilation from the command line

javac -d ./build *.java

如果没有错误,在构建目录中你应该有你的类树

if there are no errors, in the build directory you should have your class tree

移动到构建目录并做一个

move to the build directory and do a

jar cvf YourJar.jar *

用于添加清单检查jar命令行开关

For adding manifest check jar command line switches

这篇关于如何从.java创建JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆