June 08, 2010

Make JavaFX applets smooth on Firefox for Mac

Lately when I was browsing websites with JavaFX applets I noticed the Java plugin would either not work, load slowly, crash or flicker when scrolling the page. This wasn't the case on Safari, so I looked at the about:plugins URL which lists the currently installed plugins in Firefox.

I noticed 2 unknown plugins to me called MRJPlugin and Java Embedding Plugin, a plugin that's apparently shipped with every Firefox on Mac OSX. Basically this plugin allows to use the latest Java version in the browser. Since Java 6 update 10 with it's Java Applet Plugin v2 is available for Mac OSX Snow Leopard, it's actually not necessary to have the J.E.P. plugin enabled. In fact Firefox prefers this plugin over the official Sun Java Applet Plugin v2 wich offers improved load times, browser integration, stability, etc.

After I removed both plugins, Firefox was loading applets incredibly fast, near Flash load time performance. The applets don't flicker anymore when scrolling and so far haven't crashed on me.

To remove the unnecessary plugins you should remove both the files MRJPlugin.plugin and JavaEmbeddingPlugin.bundle from /Applications/Firefox.app/Contents/MacOS/Plugins .
To open the Firefox.app bundle in Finder you need to Ctrl+Click and choose Show Package Contents.

I hope this improves your JavaFX experience...

February 09, 2010

JSmooth Windows Service with custom JRE

For a customer I needed a solution to launch a standalone Java application as a Windows Service. After evaluating a number of solutions I ended up with JSmooth 0.9.9-7 http://jsmooth.sourceforge.net/ a very nice open source product with nice GUI to guide you through the process.

Because the product of my customer depends on a specific JVM version we decided to bundle our JVM version with the product. JSmooth supports bundling a custom JVM, however when running as a windows service it ignores this setting. It's been a while since the original author responded to forum messages or released a new version, so I decided to jump in the C++ code. I'm nowhere near a C++ expert, but managed to create a simple workaround.

My bugfix (source + skeleton binary) can be downloaded here.

Just drop the winservice.exe file in your JSmooth installation under /skeletons/winservice-wrapper/ and recompile your service EXE. The service logfile should now be populated with messages indicating it's attempting to run your bundled VM and so on.

Enjoy!

August 20, 2009

Video in Java, no more JMF please, use JavaFX!

I often get email from people asking me to help them with playing video in Java using JMF & FOBS, probably because of my post from last year: playing-flash-video-flv-with-java

The reason why I'm writing this is to make it clear to people that time has moved on since last year, and the long awaited Java Media Components framework which was annouced a few years ago has finally hit the shelves as the media playing capability built into JavaFX. So rest assured, you don't have to hack your way around JMF to integrate FFMPEG to play all your movies.

Just follow this link to the JavaFX samples website, there are plenty of better ways to play video in Java than a year ago. But you'd have to use JavaFX for that, don't worry JavaFX is simple and runs under Java so it integrates well with a regular Java app/applet.