While J++ conformed to the Java
language specification,
Microsoft did not implement certain features of the official Sun Java implementation in its Visual J++ product line.
Remote Method Invocation (Java RMI) and
Java Native Interface (JNI) are such examples. In addition, J++ implemented other extensions that were not part of
Sun's Java implementation. The inclusion of
callbacks and
delegates for
event handling further defined J++ as a completely different language merely based on an already existing design concept. Furthermore, J++ applications did not conform to the same standardized method of accessing the underlying operating system functions as any other Java application under
Sun's Java SDK. In
Microsoft's implementation, an underlying
framework called
J/Direct provided a base mechanism that allowed J++ applications to completely circumvent Java's
class libraries and
API in accessing the underlying operating system. Due to this short-cut around the original
Java framework, J++ applications were more efficient in taking advantage of
Win32 API functions than Java applications. J++ applications using these features could not be run on Sun's Java SDK, but the
Kaffe project developed extensions which made it possible to run J++ applications with these features on their open sourced
JVM. However, these extensions (implemented by TransVirtual under Microsoft funding) were not widely used, and J++ applications still needed to be compiled on Visual J++ before being able to be run by Kaffe. Visual J++ supported
ActiveX.
Example Here are some examples of Visual J++. Using
Windows Forms: package org.wikipedia.examples; import com.ms.ui.ActionEvent; import com.ms.ui.ActionListener; import com.ms.ui.Button; import com.ms.ui.Form; public class SimpleForm { public static void main(String[] args) { Form form = new Form("Simple Form"); Button button = new Button(); button.setText("Click Me"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { form.setText("Button Clicked!"); } }); form.add(button); form.show(); } } Calling
ActiveX: package org.wikipedia.examples; import com.ms.activeX.ActiveXComponent; import com.ms.activeX.Variant; public class Example { public static void main(String[] args) { try { ActiveXComponent ax = new ActiveXComponent("InternetExplorer.Application"); ax.setProperty("Visible", new Variant(true)); ax.invoke("Navigate", new Variant("http://www.microsoft.com")); } catch (Exception e) { e.printStackTrace(); } } } Calling the
Windows API: package org.wikipedia.examples; import com.ms.win32.RegistryKey; import com.ms.win32.User32; public class Example { public static void main(String[] args) { // Spawn a message box User32 user32 = new User32(); user32.MessageBox(0, "Hello from Windows API!", "Visual J++", 0); // Read a registry key RegistryKey key = new RegistryKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion"); String productName = key.getStringValue("ProductName"); System.out.printf("Product Name: %s%n", productName); } } == The WFC == The Windows Foundation Classes (WFC) encapsulated the Microsoft
Win32 platform
API and
DHTML object models into a unified class library. WFC was primarily designed for creating
graphical user interfaces for Java applications on Windows. == Sun's litigation against Microsoft ==