telnetj is a 100% Java™ technology library for implementing telnet servers (not clients!).
It is useful for adding remote command-line or other remote text interface to your Java software, or even for creating entirely remote applications.
You may also want to check out my other remote Java projects. VNCj allows a remote graphic interface, using the VNC protocol. (It can also simulate a command-line interface using its console mode). If your clients support Java, check out my more ambitious pet project, Java URL, that allows running a full Java application at the client securely and without installation, with minimal resource use.
How do I get it?
You may download telnetj with its full source code as long as you agree to the terms of GNU Lesser General Public License, which basically gives you complete freedom to change and adapt the code to suit your needs, though you are required to continue to redistribute it under the same license. I reluctantly used the lesser version of the General Public License so you may link telnetj with non-free software. The latest version is available here. Source code is in the JAR. Read the status below for more information. Right now, telnetj requires the Java 2 Platform, Standard Edition.
Robert Konigsberg has enhanced telnetj. You can download his modified source files here.
How do I use it?
Start hosts by running the main class, gnu.telnetj.Host. It will attempt to load the file telnetj.properties from the classpath. This text file has lines in the form:
Where "23" can be replaced with your port number, and "vax.VAXCommandLineInterface" with the full class name of your interface class. An instance of this class will be created for each new connection through that port. It must have have a constructor that accepts one argument - in instance of TelnetConnection. TelnetConnection is used similarly to both BufferedInputStream and BufferedOutputStream.
You may want to inherit from CommandLineInterface, as it includes some default functionality usable for command-line servers. Its commandMap property maps names of commands to instances that implement the interface Command. This makes it fairly easy to support new commands for your command-line interface. Simply add entries to the map in the constructor to your CommandLineInterface class.
How do I contact you?
My name is Tal Liron, and this is one of my pet projects. Contact me at "tliron at uchicago dot edu" if you want to help in development or report a bug, not for product support. I don't do product support.
(Java and all Java-based marks are trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other countries.