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.

Bug 68770 - Support raw-mode I/O for project execution from <java>
Summary: Support raw-mode I/O for project execution from <java>
Status: NEW
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 7.3
Hardware: All All
: P1 blocker with 6 votes (vote)
Assignee: Tomas Stupka
: 111337 135273 144562 178764 195380 235334 (view as bug list)
Depends on:
Blocks: 22641 147099 194151
  Show dependency tree
Reported: 2005-11-15 22:12 UTC by hlavac
Modified: 2014-06-09 13:29 UTC (History)
10 users (show)

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description hlavac 2005-11-15 22:12:45 UTC
Please add support for System.console() to Output Window when running program on
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 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, 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 which is marked as resolved by this issue.
Comment 16 Jiri Prox 2013-09-02 05:53:47 UTC
*** Bug 235334 has been marked as a duplicate of this bug. ***