This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
|Summary:||Support raw-mode I/O for project execution from <java>|
|Component:||Ant||Assignee:||Tomas Stupka <tstupka>|
|Severity:||blocker||CC:||anebuzelsky, fommil, mkrauskopf, mmirilovic, terje7601, thufir, tkellerer, tskorka, vanob, vv159170|
|Issue Type:||ENHANCEMENT||Exception Reporter:|
|Bug Depends on:|
|Bug Blocks:||22641, 147099, 194151|
Description hlavac 2005-11-15 22:12:45 UTC
Please add support for System.console() to Output Window when running program on JDK 6
Comment 1 hlavac 2005-11-15 22:13:13 UTC
sorry forgot to set to enhancement
Comment 2 Jesse Glick 2006-08-08 17:29:56 UTC
Difficult. Probably impossible without changing how processes are run from Ant.
Comment 3 Jesse Glick 2007-08-01 16:37:50 UTC
*** This issue has been marked as a duplicate of 56341 ***
Comment 4 Jesse Glick 2007-08-01 16:38:03 UTC
*** Issue 111337 has been marked as a duplicate of this issue. ***
Comment 5 Jesse Glick 2007-08-14 17:38:03 UTC
Comment 6 Jesse Glick 2007-08-14 17:44:15 UTC
Not the same as issue #56341, which deals with System.out.print (with no trailing newline). In my tests (JDK 6u2 on Ubuntu), System.console() simply returns null when the program is run from the IDE. (From a terminal, it works except that passwords are incorrectly echoed, making it no more useful than System.in/out.) I think there is not much NB can do about this without using native code to launch the foreign process - would need to set a controlling terminal, which is not supported by java.lang.Process and is rather OS-dependent.
Comment 7 Jiri Prox 2008-05-19 13:00:41 UTC
*** Issue 135273 has been marked as a duplicate of this issue. ***
Comment 8 Jesse Glick 2008-09-25 19:02:11 UTC
*** Issue 144562 has been marked as a duplicate of this issue. ***
Comment 9 Jesse Glick 2008-09-25 19:03:28 UTC
See issue #136929 about possible future changes in how processes are spawned.
Comment 10 Jesse Glick 2010-01-29 09:09:06 UTC
*** Bug 178764 has been marked as a duplicate of this bug. ***
Comment 11 Jesse Glick 2010-03-26 14:07:16 UTC
The Execution API does not support pty's. However it appears that dlight.nativeexecution, recently added to the ide cluster, does, so in conjunction with a terminal emulator (also now in ide cluster) this could form the basis of a raw-mode execution facility for Java SE apps. Deserves study and prototyping. Probably the best approach would be to drop the current buffering hacks for <java> run from inside the IDE, instead offering a project-level switch: 1. If off (the default), run Ant's unmodified <java> - "cooked" (line-oriented) I/O supported, using the regular build output tab, using the regular output window, with full hyperlinking e.g. of stack traces. Best for apps with no stdio beyond log messages (such as GUI apps); or some apps focused on printing lines of text to stdout/stderr, especially if the output includes non-Latin scripts (*), or if collecting and saving complete output to a log file is needed. 2. If on, reimplement <java> as a direct call to the native Java launcher, bound to a pty, using the terminal emulator in a separate output tab, with no or limited hyperlinking. Best for apps using terminal-oriented features such as unbuffered stdio, nonechoed password entry, curses-based graphics, etc. Unclear whether CoS-mode execution should use cooked or raw output. Ideally the same as what the project has configured, though this means supporting both in JavaRunnerImplementation, with an accompanying API. (*) Some scripts, especially Asian, cannot be correctly rendered when displayed as isolated glyphs in a grid, due to ligatures: compare क्षत्रिय (kṣatriya) to क् ष त् रि य (spaces inserted, k ṣa t ri ya).
Comment 12 Jesse Glick 2010-03-26 14:08:31 UTC
More general issue than just java.io.Console, though that is a motivating use case.
Comment 13 rbeede 2010-08-22 01:46:41 UTC
Would it be possible to create a class called sun.misc.SharedSecrets or even java.lang.System that is loaded on the classpath before rt.jar so it gets used instead of the JVM one? The class could then do a hand off when System.console() is requested to the Output window instead. An idea anyway. The question is how to get the classpath order to work I suppose if it is even allowed with those particular classes. A project specific run configuration setting would toggle the behavior of whether to load it or not. May have to be Java version specific though I'd guess. At least for future proofing for Java 7,8,...
Comment 14 Jesse Glick 2011-02-14 15:41:30 UTC
*** Bug 195380 has been marked as a duplicate of this bug. ***
Comment 15 jyeary 2013-06-11 14:35:37 UTC
This bug is related to https://netbeans.org/bugzilla/show_bug.cgi?id=178764 which is marked as resolved by this issue.