1. Download the file eric.jar from the following linkDownload the eric.jar library here
or
Download the jar as a zip file here and save it to your hard drive.
2. * Right-click on the icon for your project in the NetBeans IDE and select 'Properties'
(Make sure the panel on the left is showing the 'Project' pane. The icon for your project
is the coffee-cup icon with your project's name next to it)

The following window should appear:

* Click on libraries in the tree on the left.

* Then on the right, click on 'Add Jar/Folder'
* Navigate to the location on your hard drive where you saved eric.jar. Then select eric.jar and click on 'Open'
The eric.jar file will appear in the list of compile-time libraries as shown below:

* Click 'OK'
That's it.
Then:
In your code add the following line as the first executable lines in your 'main' function
new eric.Console();
or
new eric.Console(XXX); //where XXX is the size of the scrollback buffer in chars
Repeat steps 2 and 3 for any console application you create.
The code will cause a new FULLY INTERACTIVE console window to pop-up for you program.
Note the following:
Your program will not totally end until you close the console window created for it.
download the SOURCE CODE Here
About Eric Berkowitz's Netbeans
Java Console to Run an Interactive Java Console Application
(Java Terminal Application)
NEW Version 3.5 of the Java
Console for Netbeans
If you hate using Netbeans for java console
applications
if you hate the the way the Netbeans embedded console area works
or if you just want a normal console window for your console
applications...
Try this utility. It creates a
separate
console
outside of the IDE simply by inserting the line new eric.Console()
or new eric.Console(XXX)
[XXX=size
of
scrollback
buffer
in
chars]
at
the
beginning
of
your
program.
in, out and err are
automatically redirected
to the new console. No
changes
to
your
code
are
required.
now PC/Mac/Linux
Compatible
(see below)
I finally posted the
NetBeans projects with the source code for the java console and a short
program to test it. It is quite a bit of sloppy code but it
works.
If you like it please send me a line.
If you do anything to enhance it or even to clean it up, please send me
a copy as I do not have time these days to work on it.
Binary (jar file) and instructions are here
Eric's
Console
Source
Code
A short
program to test the console |
- Latest updates: Version 3.5 - April 2011
- Version 3.5
- It is now possible to pause and resume the
Java Console Application output in the scroll window
- It is now possible to terminate the underlying
Java Console Application leaving the features of the Java Console
active.
- Version 3.3
- Stay-on-top option for the Console window.
- Save As ... option to save the text in the
console window to a file.
- Version 3.1
- Macintosh improvements: Improved handling of
command-q and window-closing events both before and after a call to
System.exit()
- General improvements: Window title is now set
to your main program class
- Major Version 3.0
- The code should be completely
portable in both source and binary. All Mac related code is
implemented using reflection so the source should compile and run on
systems without the Apple API [ Yes I bothered to learn the Java
Reflection API last night, just for this project ]
- I had to change the structure of
Console.java a bit so that system properties could be set before the
JFrame constructor is called.
- I put most of the Apple code in a
separate class though it could have been added as inner classes to
Console.java.
- Version 2.6
- Paste from the system clipboard is now
supported
- All the old functions now appear in
appropriate menubar entries.
- Search functionality has been added.
- Find
searches from the cursor or from the top of the buffer if the cursor is
at the very end.
- Find Next
always searchs forward from the last match (though it will wrap if
clicked again after reporting a failure)
- Find
Previous always searches backward from the last match (though it
will wrap if clicked again after reporting a failure)
- Version 2.5
- Since I needed it for a project I
am working on that put a tremendous amount of text in the console, the
eric.console now has basic searching capability including find and find next...
- Find
will start at the first character if the cursor is positioned after
the last printed character or at the current cursor position otherwise.
- Find
Next always starts after the last match
- As of version 2.5 it is safe to call System.exit
this
no
longer
closes the java console
- Calling
System.exit when using the
java console pops up a warning dialog
- Closing the
java console window
itself terminates the program (as it should)
- A mono-spaced
font in the java
console for terminal-like
text alignment
- Overall, a more
terminal-like
behavior for the java console
- Copy/Copy-Selection
to the system
clipboard from the java console
- Print/Print-Selection
from the java
console
- Window clearing
in the java console
- Java 1.5 or newer
- Some historical reasons this console exists
in the first place:
- Netbeans 6.0-preview buffers both out and err streams
separately so ...
- Output in
Netbeans does not appear
until a hard-return (or explicit flush) clears the buffers.
- The
two
streams
are
not
synchronized.
Output
to
err
and out are interleaved
unpredictably. (It is actually predictable, but still annoying)
- The old rationale
was that Netbeans
4 did not
support the development of
interactive console applications at all. Newer versions of Netbeans now
support such programs. Still, my terminal program is very
useful
for:
- Students used to standard
terminal
programming (such as those migrating from C/C++ intro courses)
- As a console for JSP/Servlet
debugging --
Just call new eric.console(); once
per Tomcat instance from inside a JSP or Servlet
and
debugging messages can be printed to System.out to show up in the
console instead of a log file. JSP/Servlet error messages
will
also end up in the console.