JetBrains Projector : Bringing New Life to Legacy Java Swing Applications

Praveen Manvi
5 min readMay 22, 2021

--

Projector is a technology to run and access Swing GUI applications remotely. Here I am noting down my experience while running one of my side pet swing project running in browser. The results I have seen so far has been mind blowing. The joy of seeing my old swing app in browser without adding a single line of code is priceless.

Just to give some background, I was Java swing developer (I worked as Lead Engineer in Yahoo! developing SiteBuilder a decent desktop product but now decommissioned in favour of web based solution) about 13 years back. I loved working on this technology. The kind of control over paint of a ui component and layout management (although its quite verbose and boring), never experienced with any of modern web component based UI development (including Vaadin/JSF and GWT).

I developed suit of swing applications helping to author/publish and manage exams. The feature set is considerably complex that include Multiple choice question (MCQ), User typing answers, Result/Certificate management, Secure with screen and video tracking, OCR enabled question paper generation, MathML rendering, Analytics, Random access, mark, tag and time bound exams. It also have elastic based to question search system for questions to build exam through shopping cart browsing model to build question paper considering the various inputs (difficulty level, over-all composure, sections, weightage etc…)

Now here I have included some of the screenshots showing how seamlessly I was able to run the swing in browser, also notes few limitations.

Big thanks to awesome engineering folks behind ‘projector’, they just suddenly made my 10+ years old work more accessible. Now humble request to JetBrains -> Please make this product first class citizen among your product suits. Like my current application below there will be 100s of such heavy swing application will automatically available for masses. This is AWESOME product. Running of heavy android studio OR big applications in Idea can save many of hours of developers to setup/run and deploy. We could install make use of local intranet servers OR cloud resources to run this app. This can be game changer for large projects using idea Idea IDE and re-inventing swing apps usage from browser.

So what next?

Automating with amazon ec2 machines (scheduled on-demand OR spot instances) to launch one instance for each user signed up for taking exams. One JVM per user is limiting for many applications, For current application requirement where its long running session heavy application it may not be an issue. The exploiting the ec2 deployment and pricing model as this is scheduled and time bound should work better. Will update the in this space about the experience as will try to make use in larger scale, using sdk way of managing cloud resources with CDK OR terraform.

Also planning to re-build this application in Jetpack Compose and KMM to make them available for mobile apps.I am bullish about the future of these technologies including ktor for building RESTful server APIs.

Here are few screenshots of running one of my swing app in browser.

The actions like HTML rendering and actions to launch of browser worked fine.

3rd party libs like Jfreechart worked just fine.

Few of the custom components also worked fine.

All I needed was to mention the main class and the copy the jar file (I created a single fat jar) and provide in classpath. Please note that projector provides a easy to copy ‘dist’ folder to copy and run from any machine.

Now there were problems.

1.The scrollbar component is too slow. Whenever I had the JScrollbar with large text OR image it takes considerable amount of time. I guess its something to do with implementation and not actually network latency issue.

2. The rendering was not clean for some the components and updateUI/validate calls were not behaving correctly. Swing might be more forgiving as native application just worked fine, need to take closer look

3. I used JsyntaxPane (java library) to highlight language syntax. This didn’t work. The highlights were missing the code editing experience is also not as good as native application.

This is from swing application (highlight and code editor is missing)

Above is from projector it where highlight and code editing features are missing.

4. The live video and screen recording did not work, I am using openCV java library to for web camera capture. Its its expected given its native integration. This is how the native swing application looks like. It streams the user actions in video and also computer screens dump to check on malpractices, It also takes a photo dynamically and makes into into certificate as shown below.

5. You can’t scale to multiple users OR sessions. One JVM can work with only UI, any browser you session will be shared. This is great limitation. If the application is light we do want invoke as many sessions as possible with single server.

Summary

The ‘projector’ holds a great promise.

--

--

Praveen Manvi
Praveen Manvi

Written by Praveen Manvi

Senior (Architect, Director, VP) Software Engineer. Building web scale SaaS/Multi-Tenant Solutions in Cloud (AWS,GCP,Azure). Ex-Yahoo, Ex-Oracle, Ex-{startups}.