mabe02/lanterna

Terminal On Windows

Closed this issue · 4 comments

Hi
Code works fine on Linux but on windows it can't find Terminal.
Error:

Exception in thread "main" java.io.IOException: To start java on Windows, use javaw! (see https://github.com/mabe02/lanterna/issues/335 ) at com.googlecode.lanterna.terminal.DefaultTerminalFactory.createWindowsTerminal(DefaultTerminalFactory.java:457) at com.googlecode.lanterna.terminal.DefaultTerminalFactory.createHeadlessTerminal(DefaultTerminalFactory.java:140) at com.googlecode.lanterna.terminal.DefaultTerminalFactory.createTerminal(DefaultTerminalFactory.java:113) at TypeConsole.App.main(App.java:25) Caused by: java.io.IOException: Cannot run program "stty.exe": CreateProcess error=2, The system cannot find the file specified at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1142) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073) at com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal.exec(UnixLikeTTYTerminal.java:158) at com.googlecode.lanterna.terminal.ansi.CygwinTerminal.runSTTYCommand(CygwinTerminal.java:94) at com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal.saveTerminalSettings(UnixLikeTTYTerminal.java:113) at com.googlecode.lanterna.terminal.ansi.UnixLikeTerminal.acquire(UnixLikeTerminal.java:86) at com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal.realAcquire(UnixLikeTTYTerminal.java:86) at com.googlecode.lanterna.terminal.ansi.UnixLikeTTYTerminal.<init>(UnixLikeTTYTerminal.java:77) at com.googlecode.lanterna.terminal.ansi.CygwinTerminal.<init>(CygwinTerminal.java:63) at com.googlecode.lanterna.terminal.DefaultTerminalFactory.createCygwinTerminal(DefaultTerminalFactory.java:463) at com.googlecode.lanterna.terminal.DefaultTerminalFactory.createWindowsTerminal(DefaultTerminalFactory.java:455) ... 3 more Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.base/java.lang.ProcessImpl.create(Native Method) at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:483) at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1109) ... 13 more

By using javaw it opens a SwingTerminalFrame window which many functionalities are not working

avl42 commented

Terminal applications, such as what Lanterna helps one to create, aren't natively "at home" in Windows... One solution are SwingTerminal apps (with javaw.exe). You might want to help add the missing bits to it. Another would be installing Cygwin and use Lanterna in Cygwin terminals. Another would be the WindowsTerminal (using JNA, iirc), which would need some active developers/testers to get into shape. For a starter, look at the tree "native-integration" and try to get that into your build environment. (I can't help much there - my own computers are a "Window"-less environment.)

OK. thanks

@DarkDeveloper-Plant Have you tried 3.2.0-alpha1 yet? I've been using the JNA for a year and it works well for my use cases:
#422

The JNA implementation is production-ready as far as I can say, and definitely preferable to the To start java on Windows, use javaw! error message. I'd rather get a "can't load JNA" error message, and then go ahead and add JNA to the classpath.