简体   繁体   English

通过 Java 编写命令提示符?

[英]Writing in Command Prompt through Java?

So my question may be a little wide so I'll narrow it down here, I have been able to develop code that easily opens command prompt.所以我的问题可能有点宽泛,所以我会在这里缩小范围,我已经能够开发可以轻松打开命令提示符的代码。 My question is this, through say the IDE Eclipse, if I ran my program their that printed out HELLO!, how could I make it appear on the command prompt WITHOUT!!!我的问题是,通过 IDE Eclipse,如果我运行我的程序,打印出 HELLO! actually accessing command prompt and running my code their?实际访问命令提示符并运行我的代码?

More calarification?更多的澄清? I need a line of code or method that when its executed it opens the command prompt and writes hello.我需要一行代码或方法,当它执行时,它会打开命令提示符并写入 hello。 Many would say why not have it run to say hello there but thats defeating the purpose of my task.许多人会说为什么不让它运行以在那里打招呼,但这违背了我的任务的目的。 To clarify further, if I was to run this in windows command prompt instead of eclipse, it would still open a new command prompt window and write hello in their acting as the System.out, THANKS!为了进一步澄清,如果我在 Windows 命令提示符而不是 eclipse 中运行它,它仍然会打开一个新的命令提示符窗口并在它们充当 System.out 时写下 hello,谢谢!

Disclaimer: I don't recommend this, just answering the question免责声明:我不推荐这个,只是回答这个问题

You'd have to run Java in each console with an application that was listening for data from the controlling application (not going to get into how that communication could work, but sockets would be an obvious choice).您必须在每个控制台中运行 Java,其中有一个应用程序正在侦听来自控制应用程序的数据(不打算讨论该通信如何工作,但套接字将是一个明显的选择)。

The listening application could then write to the console when it receives data from the controlling application - more trouble than it's worth imho当监听应用程序从控制应用程序接收数据时,它可以写入控制台 - 比它值得的麻烦更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM