DEV Community

Cover image for Making JPad: a cross-platform text editor.

Posted on

Making JPad: a cross-platform text editor.

Based off the name, some of you might have guessed that JPad is written in Java: my main language. I chose to make JPad because I wanted a simple, quick, lightweight text editor - like Windows' Notepad - with built-in syntax highlighting. Creating this project is also proving to help refine my Java skills and learn some new concepts.

Before I get into it, you can check out JPad on the GitHub repo (it's open source!)

About JPad

JPad is an open-source, cross-platform, and lightweight text editor desktop application - written in Java with the Swing GUI framework. JPad is currently in beta, so there might be some unexpected bugs and incomplete/missing features, but I am working hard on improving and adding these features.

A screenshot of JPad

Why make JPad?

How many times have you opened up Notepad or TextEdit to quickly analyse some code, but it's just a jumbled mess of black-and-white? For me, at least, this was a common occurrence. I didn't want to open an entire beefy IDE like IntelliJ just to quickly view or modify one file, however, it was always annoying trying to work with source code that was formatted in plaintext.

Now, I know what you might be thinking: why not just use Notepad++? My vision for JPad was to be simpler than Notepad++. Don't get me wrong, NPP an amazing lightweight text editor, but I wasn't trying to make JPad into a multi-file development environment. I just wanted something simple.

Tech Stack

I chose to create JPad with Java and Swing. I very much could've chosen another language, but I stuck with Java because it's the language I am most familiar and comfortable with - not to mention, WORA is quite handy. I would consider Go to be my secondary language, but I didn't think it to be the right fit for this project. Furthermore, I had worked mostly with JavaFX before, so learning and using Swing was a good way to help improve my skills.

After having chosen the language and framework, I got to work. The main 'selling point' of JPad would be the syntax highlighting, of course. After some research, I came across a really awesome project called RSyntaxTextArea which is a superset of Swing's JTextArea, except it had built-in syntax highlighting for multiple languages. I then made a quick mock-up of the UI in Figma and integrated RSytnaxTextArea into my app.

Because I chose Java, making JPad cross-platform wasn't so hard. With that being said, there are a few challenges when writing a single codebase to work in a cross-platform manner. I find that there are many ifs and switches to check which OS the user is on so that features work as intended. For example, I had to set some specific System properties to manage to get my main JMenu to use macOS' native menu bar. I haven't actually had the opportunity to test JPad on any Linux system yet, but it should (hopefully) work. Learning to package the app was also a bit of a pain because it was something I had never done before...


Unfortunately, officially signing an app is very expensive - especially when doing so for many different operating systems. Although JPad isn't harmful, many operating systems and antiviruses will flag it as potentially dangerous. This is just one hurdle I have experienced when packaging this cross-platform app.

Packaging JPad has been a very different experience across different operating systems. The basic .jar isn't actually so bad; the JDK has a built-in jarsigner command which helps you self-sign the jar file including the ability to add timestamps and expiry dates. Of course, however, self-signing isn't quite as renowned as using an official certificate.

Packaging JPad for Windows was a little more tedious. I came across a cool program called Launch4J which allowed me to wrap my jar as a .exe. In all honesty, after you have the template down, it's easy to repeat. Afterwards, I used a tool called Inno Setup which made it quite straight forward to make an installer for the executable file. After all of this, a JPad.exe was ready.

The process for macOS wasn't too bad either. I used an official CLI tool called jpackage which helped me package JPad for macOS. At first, it was hard understanding how exactly to use the command and which flags were important. However, after some time researching, I managed to make a .dmg for JPad. I believe jpackage can also be used to make a .exe, but the Windows programs mentioned made the process nicer; I couldn't find any decent programs like them for mac, so I resorted to jpackage.


I hope you enjoyed this blog about JPad. As mentioned, JPad is still in beta so there's lots still to do. However, I am quite happy with my progress. If you have any questions, advice, or general thoughts, please leave a comment :)

Furthermore, anyone is welcome to contribute! If you're interested, head over to the GitHub repo linked at the top of the article. There's also a short markdown file on how to contribute.

Finally, I wanted to note that I will continue to write more articles on JPad as it progresses (potentially in a more devlog-like way), so stick around for those!

Top comments (0)