I had encountered a blog on Troll’s website (can not recall where exactly it was, and who posted it… if you find it, please notify me) about creating Java objects from C++. More precisely, creating Qt Jambi widgets and using them in a C++ program.

It gave me an idea. How about a Java-based Plasmoid? We have Python, JavaScript (ECMAScript) and what not, but no Java.

There still are no Java bindings for Plasma, but that doesn’t mean that there can not be Java Plasmoids. If you think that I’m talking gibberish, just look at the following screenshot. As you can see, there are a couple of plasmoids that say Java (to be exact, there are 4 of them).

Java in Plasma
Java in Plasma

No, they are not C++ plasmoids that just write ‘Java’ to fool you, those are applets written in Java. You have the code in Plasma’s playground (/trunk/playground/base/plasma/applets/java).

The main problem is setting up the environment.

  1. First you have to install Java SDK (tested with SUN’s, it should also work with IcedTea),
  2. then, you have to install (or compile) Qt Jambi which is a bit pain in the neck if you have Qt with debug symbols included.
  3. And, once it is all installed, you need to set the environment variables both for compiling the applet, and running it in Plasma afterwards. You can use the environment.sh that is included with the source, and modify it to your needs. You also need to change the Jambi’s path in CMakeLists.txt.

Well, that should be all. When I find the time to try to generate Plasma bindings for Java, you will be notified :) (To be honest, I hope that someone will beat me to it)

Cheerio!