The Wannabe Java Rockstar: JNIWrapper - Java Desktop Integration Done Right

JNIWrapper - Java Desktop Integration Done Right

Here's my recommendation for SUN: dump JDIC and buy these guys. Their JNIWrapper is an amazing product. I've already blogged about it.

At the core, the JNIWrapper simplifies accessing native code. This is done via a dynamic invocation interface. It is well designed and easy to use:

public class ShellExecute {
 
private static final FunctionName SHELL_EXECUTE =
   
new FunctionName("ShellExecute");

 
public static boolean execute(String file) {
   
Function shellExecute =
      Shell32.getInstance
().getFunction(SHELL_EXECUTE.toString());
    Int32 ret =
new Int32();
    shellExecute.invoke
(ret, // return value
                       
new Parameter[] {
                         
new Handle(), // hWnd
                         
new Str("open"), // lpOperation
                         
new Str(file), // lpFile
                         
new Str(), // lpParameters
                         
new Str(), // lpDirectory
                         
new Int32(1// nShowCmd
                       
});
   
if(ret.getValue() <= 32) {
       
System.err.println("could not execute ShellExecute: " +
                           file +
". Return: " + ret.getValue());
   
}
   
return (ret.getValue() > 32);
 
}
 
 
public static void main(String[] args) {
   
ShellExecute.execute("http://weblog.janek.org");
 
}
}

The code uses Window's ShellExecute function to open my weblog in the Windows standard browser.

On top of JNIWrapper, they implemented WinPack. Just as examples, here's what can be done with it. In my applications, I use it to

JNIWrapper's latest project, JExplorer, provides a Java API for embedding Internet Explorer. It closely resembles theWebBrowser control API. Integration with Mozilla is on the way.

Their support is exceptional. Wenn JNIWrapper 2.4 came out, I discovered a bug on Windows 98. It was fixed in less than an hour. And when you look at their prices, you'll find that the product is downright cheap. A Linux version of JNIWrapper is available as well.

Sun, 27 Jun 2004, 23:58 | Java | PermaLink
« Can this possibly be efficient? | Home | Ping Weblogs.com and Co with Python »