java 类文件到 jar 应用程序
我想知道如何使用java的类文件制作一个在java移动平台上运行的jar应用程序。 我知道java的基础知识,比如继承,接口,字符串......我通过编译简单输入/输出的java程序然后使用cmd中的-jar将其转换为jar来尝试这个东西。但我不知道为什么它不是在移动设备上工作显示无效文件。 请帮助我。
i want to know how to make a jar app which will run on java mobile platform using class file of java.
i know basics of java like inheritance,interface,string.....I tried this thing by compiling my java program of simple input/output and then converting it to jar using -jar in cmd.but i dont know why it is not working on mobile showing invalid file.
plz help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果你想创建一个jar应用程序,从java类开始,你不必使用
java -jar filename.jar
,这只是为了执行。试试这个:
jar cf your_jar_app.jar your_class_file.class
c
选项需要创建文件,并且需要f
选项,因为您想要一个输出文件。然后你可以执行输入:
java -jar your_jar_app.jar
希望这可以帮助你。
有关文档:用于创建 JAR 文件的 Oracle 文档
如果您使用的是 NetBeans IDE,请查看:NetBeans 打包和部署 Java 应用程序< /a>
If you want to create a jar application, starting from a java class,you don't have to use
java -jar filename.jar
, this is only for execution.Try this:
jar cf your_jar_app.jar your_class_file.class
c
option is needed to create file andf
option is needed because you want an output file.Then you can execute typing:
java -jar your_jar_app.jar
Hope this can help you.
For documentation: Oracle Documentation for creating JAR file
If you are using NetBeans IDE, take a look to: NetBeans Packaging and Deploying Java Applications