Download site for AR Common
This is a common project for most of the tools that I have build, that contains many general features that have been designed with the intent of reuse.
Most of the methods in this project are static, as they are intended to be called directly without any state creation, configuration / setup or initialization.
Many of the methods have many overloaded variants, which typically are designed in such way, that the variant with the fewest parameters, is the one that handles all the common use cases. The other variants are for the more special cases.
Some of the methods have two variants: One with and without the boolean throwOnFail (See StringUtil.stringToInt). The "without" variant will throw an RuntimeException if something goes wrong. The "with" variant will do the same if throwOnFail is true. If throwOnFail is false, it will return null and/or do nothing.
Feature list
- Initialize the application with only one line of code using the ApplicationsUtil
- Simple, easy and persistent application settings with very few lines of code using the methods setDefaultSettingsClass(), load() and save() in the SettingUtil (Including XML serializer and deserializer)
- Automatic save of the state (Location and size) of frames and dialogs by extending AbstractSettingsJFrame and AbstractSettingsJDialog respectively
- The FileUtil class contains many file / disk / IO methods such as readFile(), writeFile() and findAllFilesInDirectory()
- The GUIUtil class contains many GUI methods such as showInformation(), showYesNoCancelDialog(), selectAFile() and selectADirectory()
- The ReflectionUtil class contains methods for doing Java reflection such as getFieldValue(), setFieldValue() and invokeMethod()
- The ProcessUtil class contains methods for starting / running processes such as startCommand(), executeCommand[StdInput][StdOutput]() (Many variants) and isProcessRunning()
- The StringUtil class contains some string methods that I have found are missing the String class such as stringToInt() and longToStringWithFixLengthWithSpace()
This class also contains convenience methods for regular expression such as getIndexOfFirstRegExpMatch(), getGroupsForRegExp[AsFlatArray](), doesStringMatchRegExp() and getFirstNameGroupForRegExp()
- Pretty printed fairly human-readable XML serializer and deserializer (See the XmlSerializer and XmlDeserializer classes)
- The XmlUtil class contains methods for XML processing such as saxParseXml(), objectToXmlFile(), xmlFileToObject(), selectNodes() and stringToDocument()
- The arcommon.ui.component package contains many small and common but very useful extension of Java Swing components.
A standard example of this is the MyJList class / component that wraps a JList<String> in a JScrollPane.
- Create forms / options like dialogs / components using the LabelFieldJComponent class
- Create OK-cancel dialogs / frames using the AbstractOKCancelSettingsJDialog or AbstractOKCancelSettingsJFrame classes.
They use the OkCancelButtonBarJComponent class to do it which can be used on its own.
- The SimpleImageJComponent class makes it easy to load and view an image and it has a build-in scale feature
- The arcommon.progress package contains classes that make it possible to have (Optional) feedback on long running actions.
For example the FileUtil.copy() method uses these classes to make it possible give feedback on the state / progress of copying a large file on to a slow disk.
The SimpleProgressJDialog class can be used to give it as GUI feedback.
- The ClipboardUtil class contains methods for reading and writing text and images to the clipboard such as readTextFromClipboard(), writeTextToClipboard(), readImageFromClipboard(), writeImageToClipboard(), isTextAvailable() and isImageAvailable()
- The ImageUtil class contains methods for reading and writing images to the disk such as saveToFile(), loadFromFile(), imageToPixelArray(), pixelArrayToImage() and componentToImage()
- The ZipUtil class contains methods for zipping and unzipping files such as zipFiles(), unzipFiles(), listFilesInZipFile() and deleteFileInZipFile()
- The NetUtil class contains methods for the Internet (http / https) such as downloadFile(), downloadContentOf(), openBrowser(), openBrowserWithDialog(), decodeUrl(), encodeUrlMyVariant(), encodeUrlPart() and decodeHtml()
- The ExceptionUtil class contains methods for handling exception such as installStandardGuiExceptionHandler(), installStandardTuiExceptionHandler() and showLogAndPrintException()
- The RobotUtil class contains methods for simulating mouse and keyboard events (in other applications) such as moveMouseTo(), dragMouseTo(), getMouseLocation(), mousePress(), keyPress(), type() and doScreenCapture()
- The SerializableUtil class contains methods for serialization such as loadObjectFromFile() and saveObjectToFile()
- The DateUtil class contains methods for handling and formating dates such as dateToDanishString(), dateToDateSortableString(), parseTime() and nanoTimeDiffToString()
- Create TCP/IP connections using the LineClient and LineServer classes for easy sending and receiving text lines over the Internet.
- Create pretty printed and validated HTML files using the HtmlWriter class.
Installation
- Download this file
- Configure the development tool or application to use the downloaded jar file
- Change your code to use the API
- If you are using JDK version 17 or higher
- and you are the using the XmlDeserializer or XmlSerializer classes you must add the following to the run command / launch:
(indirectly used by ApplicationUtil and SettingsUtil)
--add-opens java.base/java.util=ALL-UNNAMED
- and you are the using the GUIUTil.setLinuxApplicationName() method you must add the following to the run command / launch:
(indirectly used by ApplicationUtil)
--add-opens java.desktop/sun.awt.X11=ALL-UNNAMED
to avoid errors like:
Unable to make field private static final long java.util.HashMap.serialVersionUID accessible: module java.base does not "opens java.util" to unnamed module...
Uninstallation
- Remove any changes made to run command / launch
- Delete the downloaded file
Javadoc
The newest version is: 1.1.8
Release notes
Development
Java Source, ABT module property file and Other project files.
For other information about the source code see the General source code notes page
Other dependencies
- Java Runtime Environment (JRE) version: 1.6
See the List of projects page for other projects.
Last Updated: 2026-07-01 14:48:49
Copyright Allan Rasmussen©