Maxim>Products> iButton > Software Resources > 1-Wire API for Java Software Development Kit

1-Wire API for Java Software Development Kit

The 1-Wire® API for Java™ Software Development Kit (SDK) is a robust, highly object-oriented foundation for building 1-Wire applications in Java. With this SDK, programmers can develop portable, cross-platform software and shorten the time to market for their products.

The API consists of many Java classes and interfaces. Two special classes should be noted: the DSPortAdapter class, and the OneWireContainer class. The DSPortAdapter class represents a physical 1-Wire adapter or a virtual 1-Wire adapter through a TCP/IP network. The OneWireContainer classes (e.g. containers) support specific 1-Wire devices, including iButtons. The API has 34 different container types, representing most 1-Wire devices; each container encapsulates and implements the functionality of an individual device. To download the latest 1-Wire API for Java SDK, please see the following link:
Download Version 1.10 (Now supports DS9490 USB 1-Wire Adapter!)
Download Addendum (Now supports 64-bit JNI!)

1-Wire API for Java Contents

  • The API Jar File. This is the jar file containing all the 1-Wire API Java classes, including the containers mentioned above.
  • Source Code. The source code to the entire API has been provided and can be found in the download.
  • Documentation. The documentation contains thorough javadocs. They are also available on-line at For developers new to the 1-Wire API, do not miss the simple 1-Wire primer in the javadocs.
  • Example Programs. Twenty-six example programs are included (with source code) that exercise various 1-Wire devices. They provide excellent storehouses of code from which to copy and paste. Here is a list of some of them:

1-Wire Adapter Drivers and OS Support

For the API to work properly with 1-Wire adapters, the native drivers for the various 1-Wire adapters (USB, serial, or parallel port) must be installed. For Microsoft Windows platforms, installation can be accomplished through the 1-Wire Drivers installation package. For Linux and other OS platforms, support for the DS9097U serial port 1-Wire adapter can be installed through RXTX (or other equivalent software packages compliant with the Java Communications API). Maxim's MxTNI™ networked microcontroller platform has its own native 1-Wire ports, thus making driver installation unnecessary. See the table below for details about the 1-Wire Adapter driver.
OS Platform Download Description
Windows® 1-Wire Drivers (recommended) or RXTX (included) 1-Wire Drivers installation package Allows use of all adapters, including the new USB adapters on Microsoft platforms. RXTX is included in the 1-Wire API download.
Linux RXTX Download source from the RXTX website and compile. Precompiled binaries for RXTX can also be found on the OneWireViewer page.
MxTNI None Native to the MxTNI platform.
Other RXTX If your platform is supported, please download the source from the RXTX website and compile.

What's New in Version 1.10

The following list highlights the most significant additions to the 1-Wire API for Java:
  1. Added Version Info to OneWireAPI.jar. To eliminate confusion about released versions of the 1-Wire API and the "latest" version, which is downloadable with OneWireViewer (on its live WebStart page), the version info was added to the manifest file for the OneWireAPI.jar. Further, a default main method is defined in OneWireAccessProvider which will display the version number on the console with the following command:

     java -jar OneWireAPI.jar

  2. New OneWireContainers Added
    • OneWireContainer1C for the DS28E04, 4Kb EEPROM
    • OneWireContainer2D for the DS2431, 1Kb protected EEPROM
    • OneWireContainer3A for the DS2413 single addressable switch

  3. Removed support for Java-powered iButton. Support for the Java-powered iButton has been deprecated from the API. Old releases of the API still contain the container and other supporting classes, but they will not be included in this release or any future releases.

  4. Numerous bug fixes. See "changes.txt" in the root folder of your 1-Wire API directory for a full list of changes. Considerable updates were made to the DS1977 (OneWireContainer37) and the DS2422/DS1923/DS1922[L/T] (OneWireContainer41).

List of Example Programs

Program Description of Program
ADContainerDemo Interactive demo to read the output of a 1-Wire A/D such as the DS2450, DS2438, and DS2760.
DemoSHAEE Utility to excise the SHA operations of a DS1961S/DS2432.
DS2408Demo DS2408 switch interface turns on/off channels and search criteria for the DS2408.
FindiButtonsConsole Simple application that enumerates through all 1-Wire adapters and ports, and list the devices present.
HumidityTest This program finds and reads all 1-Wire devices that implement the HumidityContainer; it also interfaces and displays the current humidity until ENTER is pressed.
Hygrochron (startMission and dumpMission) DS1922/DS1923/DS2422 temperature and A/D/Humidity gathering demo consists of two applications. One application missions a DS1922/DS1923/DS2422 to collect data, and the other application dumps the mission data.
ListOW Basic 1-Wire application lists the devices present on the
default 1-Wire Adapter/Port. See the SetDefault example to set the default 1-Wire Adapter/Port.
OneWireViewer A GUI application that exercises the features of every 1-Wire device supported by the 1-Wire API for Java. A graphical viewer is provided for each of the following 1-Wire device types: ADC, real-time clock, humidity, memory, potentiometer, switch, and temperature monitor. In addition, a viewer is provided for exercising the extra features of the Thermochron, the DS1963S SHA, and the DS1961S/DS2432 SHA iButtons. All devices with general-purpose memory can utilize a 1-Wire file system with the viewer provided. See the OneWireViewer page for a Java WebStart version of the OneWireViewer.
OWDump Dumps the memory contents of all the 1-Wire devices on the default 1-Wire network in three selectable formats (raw, pages, and packets).
OWFish 1-Wire File System Shell that reads, writes, formats, and displays the file system on a 1-Wire memory device.
OWMemUtil Text-/menu-driven utility that reads and writes the memory of virtually all 1-Wire devices and iButtons (See OneWireContainer documentation for a description of Memory Banks.)
OWNetWatch Monitors the arrival and departure of all 1-Wire devices on a complex network utilizing the DS2409 Coupler to create branches. Also starts a thread to read the temperature of any DS1920/DS1820 devices found on the network.
OWWatch Monitors the arrival and departure of all 1-Wire devices on a simple 1-Wire Network. This application does not implement subbranches, but has been optimized and is very fast.
ReadClock Finds and reads all 1-Wire devices that implement the ClockContainer interface, such as the DS1994/DS2404.
ReadDigPot Finds and reads all 1-Wire devices that implement the PotentiometerContainer interface, such as the DS2890.
ReadSwitch Finds and reads all 1-Wire devices that implement the SwitchContainer interface, such as the DS2405, DS2406, DS2413, DS2408, and DS2409.
ReadTemp Finds and reads all 1-Wire devices that implement the TemperatureContainer interface, such as the DS1920, DS1921, DS1922, DS1923, DS2438, DS2760, DS18S20, DS1822, and DS18B20.
RemoteAuth This is a remote, token-authentication demo using SHA iButtons. It supports both the DS1961S/DS2432 and the DS1963S as a user token.
SetDefault Sets the default 1-Wire Network by selecting the adapter/port combination. This will write an file in a platform-specific location.
SHADebitDemo SHA iButton Demo shows an example implementation of an e-cash system using both the DS1961S/DS2432 and the DS1963S as possible user tokens. The use of a DS1963S as a hardware coprocessor is optional, and can be replaced with a software-simulated coprocessor.
StartNetAdapterHost Starts the host component for NetAdapter clients on the local machine.
SwitchDemo Text-/menu-driven utility that reads and writes the status of any 1-Wire switch.
TagViewer Java Swing application that dynamically displays and reads XML-tagged 1-Wire sensors, actuators, and branches. Also, a TagCreator application is provided for creating 1-Wire tags.
TemperatureContainerDemo Text-/menu-driven application that reads any 1-Wire device which implements the TemperatureContainer interface.
Thermochron DS1921 temperature-gathering demo consisting of two applications. One application missions a DS1921 to collect data, and the other application dumps the mission data.

List of Supported Devices

The 1-Wire API for Java supports the following iButtons and 1-Wire devices:
DS1425, DS1820, DS1822, DS18B20, DS18S20, DS1904, DS1920, DS1921, DS1922, DS1961S, DS1963L, DS1963S, DS1971, DS1972, DS1973, DS1977, DS1982, DS1985, DS1986, DS1990A, DS1991, DS1992, DS1993, DS1994, DS1995, DS1996, DS2401, DS2404, DS2405, DS2406, DS2407, DS2408, DS2409, DS2413, DS2415, DS2417, DS2422, DS2423, DS2431, DS2432, DS2438, DS2450, DS2502, DS2505, DS2506, DS2760, DS2890, DS28E04-100.

For more information on any of the above devices, download the respective datasheet which can be found from the product's QuickView description.

Support Resources

If a developer has support questions, needs code examples, or has specific hardware questions, he/she is encouraged to take advantage of the following resources: