Stata provides two ways you can program using the Java platform, Java integration and Java plugins.
Stata 17 and newer 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.
You can read more about how to use Java in Stata in [P] java.
Learn
Free webinars
NetCourses
Classroom and web training
Organizational training
Video tutorials
Third-party courses
Web resources
Teaching with Stata
© Copyright 1996–2024 StataCorp LLC. All rights reserved.
×
We use cookies to ensure that we give you the best experience on our website—to enhance site navigation, to analyze usage, and to assist in our marketing efforts. By continuing to use our site, you consent to the storing of cookies on your device and agree to delivery of content, including web fonts and JavaScript, from third party web services.
Cookie Settings
Last updated: 16 November 2022
StataCorp LLC (StataCorp) strives to provide our users with exceptional products and services. To do so, we must collect personal information from you. This information is necessary to conduct business with our existing and potential customers. We collect and use this information only where we may legally do so. This policy explains what personal information we collect, how we use it, and what rights you have to that information.
These cookies are essential for our website to function and do not store any personally identifiable information. These cookies cannot be disabled.
This website uses cookies to provide you with a better user experience. A cookie is a small piece of data our website stores on a site visitor's hard drive and accesses each time you visit so we can improve your access to our site, better understand how you use our site, and serve you content that may be of interest to you. For instance, we store a cookie when you log in to our shopping cart so that we can maintain your shopping cart should you not complete checkout. These cookies do not directly store your personal information, but they do support the ability to uniquely identify your internet browser and device.
Please note: Clearing your browser cookies at any time will undo preferences saved here. The option selected here will apply only to the device you are currently using.