I have an existing C++ backend system and need to create a user interface for it. This is my first time building any kind of GUI application. I know both C++ and Java pretty well, so I want to stick with one of these two options. The interface needs to work on Windows and Linux, and Mac support would be nice too.
I’ve read that using Java means I’ll need to create some kind of bridge to connect with my C++ code. But I’ve also heard from other developers that building GUIs directly in C++ can be really difficult and time consuming.
I really don’t want to rewrite my entire backend in Java since that would take forever. I’m trying to figure out a few things:
- What are the main pros and cons of each approach?
- If I go with Java, how complicated is it to connect to C++ code and would I need to modify my existing backend much?
- Are there any good tutorials or documentation you’d recommend for either path?
Thanks for any advice you can share!
what kind of ui are you building? simple forms or something more complex and interactive? also, how’s your c++ backend structured - does it have clean interfaces or is everything tightly coupled? that’ll make a huge difference in how messy your jni bridge ends up being.
I’ve used both approaches a lot, and I’d go with Java + JNI for what you’re doing. Setting up the bridge is pretty simple once you get the hang of it - just write C wrapper functions that expose your C++ stuff through a C interface, then call those from Java native methods. Your existing backend probably won’t need much change if it’s already well-structured. The big win is that Java GUI frameworks like Swing or JavaFX handle cross-platform stuff automatically. With C++ GUI libraries, you’re constantly hitting platform-specific issues that need extra debugging. For learning JNI, Oracle’s official docs plus some basic YouTube tutorials will get you up and running fast. Plus your dev cycle speeds up since you can tweak the UI without recompiling your whole C++ codebase.
java swing with JNI is prety chill if u kno java. did it myself, the bridge is just boilerplate after a while. your c++ might not need much tweaking unless it gets all memory weird. Qt is good too, but it’s harder to pick up.