在 Java 面板中包含命令提示符

Incude command prompt in Java panel(在 Java 面板中包含命令提示符)

本文介绍了在 Java 面板中包含命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I have a batch file that checks out code from SVN and calls few commands on it.This happens on the windows command prompt. I want to call this batch file from my java program and the command prompt must be present in the console of my application window and not as a separate window so I can see the output of the batch from my application.

Can anyone tell me how to include the command prompt to my console? I am using Swing.

解决方案

If all you want is to see the output, forget the command prompt.

  1. Create a ProcessBuilder.
  2. Call for the Process.
  3. Read the output and error streams, and send them to something like MessageConsole.

BTW - When (not if) you run into problems using a Process, see When Runtime.exec() won't & implement all the suggestions.

这篇关于在 Java 面板中包含命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在 Java 面板中包含命令提示符

基础教程推荐