【发布时间】:2008-11-29 10:23:18
【问题描述】:
我正在尝试通过 Java 运行 dot net 控制台应用程序:
process = Runtime.getRuntime().exec(commandLine);
我得到以下输出:
Detecting
The handle is invalid.
直接通过控制台(windows)运行时没有问题:
Detecting
100%
Done.
100%
我正在以这种形式运行更多应用程序,但没有问题。
得到这个堆栈跟踪:
Detecting at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Console.GetBufferInfo(Boolean throwOnNoConsole, Boolean& succeeded)
at System.Console.get_CursorTop()
at AutomaticImageOrientation.HelperClasses.General.WriteProgressToConsole(Int32 lastIndex, Int32 totalImages)
at AutomaticImageOrientation.MainManager.DetectImage(String[] files, String outputPath, String& globalErrorMessage, Dictionary`2& foundRotations)
问题是当 .net 应用程序试图写入控制台时,解决办法是什么?
找到导致问题的行:
Console.CursorLeft = 0;
你知道为什么吗?
【问题讨论】: