如何以编程方式从源代码创建可运行的jar文件? [英] How to create a runnable jar file from source code programmatically?
本文介绍了如何以编程方式从源代码创建可运行的jar文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要以编程方式从字符串创建runnable .jar
文件。我的决定是从字符串创建一个 .class
文件,并使用JarOutputStream将其添加到 .jar
。
I need to create runnable .jar
file programmatically from a string. My decision is to create a .class
file from string and add it to the .jar
using JarOutputStream.
- 我必须使用什么API来创建
.class
文件? - 是否有其他解决方案可以从源代码创建
.jar
?
- What API must I use to create the
.class
file? - Are there any other solutions to create a
.jar
from the source code?
推荐答案
为了做到这一点,你可以使用 Java编译器API 。
In order to do that, you can use the Java Compiler API.
有这个优秀的教程可以引导您完成。
这篇关于如何以编程方式从源代码创建可运行的jar文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文