Java命令行JAR文件 [英] Java Command Line Jar File
问题描述
我创建了几个.jar文件(使用Eclipse的导出功能),但他们都是GUI。我想创建一个严格命令行的.jar文件;这是可能的吗?
I've created a few .jar files (using Eclipse's export feature), but they were all GUIs. I want to create a .jar file that is strictly command-line; is this possible?
推荐答案
没有像GUI jar或命令行jar这样的东西。如果你想让程序在命令行上工作,那么你可以从System.in和System.out或文件中读取和写入,而不使用Swing或AWT。
There is no such thing as a "GUI jar" or a "command line jar". If you want a program to work on the command line, then you read and write the from System.in and System.out or files rather than using Swing or AWT.
如果在另一方面,你要求如何在命令行上创建一个jar,该命令是,不是太令人惊讶的jar。如 jar cf foo.jar com / my / foo / *。class
If on the other hand you are asking how to create a jar on the command line, the command is, not too surprisingly "jar". As in jar cf foo.jar com/my/foo/*.class
这篇关于Java命令行JAR文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!