为控制台制作一个jar文件 [英] making a jar file for console

查看:150
本文介绍了为控制台制作一个jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个没有GUI的程序,我使用控制台!所以首先我从一个用户从控制台读取一行

I have a program without a GUI and I use console! So first I read a line from a user from console


BufferedReader userReader = new BufferedReader(new InputStreamReader(System.in));

BufferedReader userReader = new BufferedReader(new InputStreamReader(System.in));

然后我会在控制台中为用户写一个答案!

and then I will write an answer for the user in the console!


System.out.println(服务器:+输出);

System.out.println("Server:"+output);

我想创建一个jar归档吧!但是如何在不使用GUI的情况下在jar文件中显示我的控制台?
请帮助我谢谢。

I want to create a jar file for it ! but how can i show my console in jar file with out using GUI? please help me thanks.

推荐答案

您需要从CLI(命令行)运行您的jar文件。喜欢:

You need to run your jar file from CLI (command line). Like:

java -jar yourJar.jar
pause

如果你想强迫这个,有不同的方法来做到这一点:

If you want to force this, there are different ways to do this:


  • 一个快捷方式文件到CMD,你的jar作为参数

  • 一个使用上面代码运行jar的批处理文件

  • 从中调用它手动批处理文件(如上所述)

这篇关于为控制台制作一个jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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