J/Direct was a technology included in some versions of Microsoft's Java Virtual Machine, which allowed direct calls into the Windows API. J/Direct was specific of Microsoft's Virtual Machine, in replacement of the standard Java Native Interface (JNI).
Since this destroyed one of the main advantages of Java, its cross-platform nature, J/Direct was often seen as an attempt by Microsoft to undermine Java's cross-platform capabilities, and an example of the tactic of Embrace, extend and extinguish.
J/Direct used a kind of annotation in Java code to make the link between Java and Windows functions. As annotations did not exist in Java when J/Direct was designed, Microsoft used a special syntax in Java comments.
/** @dll.import("USER32", entrypoint="GetSysColor") */ static native int getSysColor(int nIndex);
Additionally, the Microsoft VM used some built-in rules to be able to bind automatically the Java code to some Windows API functions. For example, it chose automatically between ANSI and Unicode versions of Windows API functions.
- "Microsoft's J/Direct called death of Java". JavaWorld. 1997-07-01. Retrieved 2010-11-20.
- "JFC; Microsoft declares war". xent.com. 1997-08-01. Retrieved 2007-07-14.
- "Aliasing (Method Renaming)". Microsoft. Retrieved 2010-11-20.
- "J/Direct". codeguru.com. Retrieved 2010-11-20.
- "How the VM Chooses Between ANSI and Unicode". Microsoft. Retrieved 2010-11-20.