»  Home »  Resources & support »  Java integration and Java plugins

Java integration and Java plugins

Stata provides two ways you can program using the Java platform, Java integration and Java plugins.

Stata 17 introduces Java integration. Java integration is a drop-in environment similar to JShell, where Java code can be executed directly in Stata. This allows Java code to be compiled and executed on-the-fly without an external program. Java integration can be used interactively, in do-files, and in ado-files. See Java integration for details.

Java plugins, introduced in Stata 13, are specialized Java classes that you can call from Stata using the javacall command. Java plugins are suitable for creating large or complex projects and require you to compile and package your Java code in a JAR file. See Java plugins for details.

Whether using Java integration or Java plugins, the Stata Function Interface (sfi) provides a bidirectional connection between Stata and Java. This package has classes to access Stata's current dataset, frames, macros, scalars, matrices, value labels, characteristics, global Mata matrices, date and time values, and more.

See the Stata-Java API for the Stata version you intend to build against and target. Note that the API versions are intended to be forward compatible, but not backward compatible. That is, a feature written using an older Stata-Java API specification may be used with a modern Stata. However, a feature written with a modern Stata-Java API may not be used in an older Stata.

Stata 17, Stata-Java API Specification
Stata 16, Stata-Java API Specification
Stata 15, Stata-Java API Specification
Stata 14, Stata-Java API Specification
Stata 13, Stata-Java API Specification

You can read more about how to use Java in Stata in [P] java.





The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn YouTube Instagram
© Copyright 1996–2021 StataCorp LLC   •   Terms of use   •   Privacy   •   Contact us