You can access existing Java classes or create your own
to use in the MATLAB workspace. For example, use built-in class
packages, such as java.util
, which are included
in the Java language. See your Java language documentation
for descriptions of these packages. You can also access classes defined
in individual .class
files, packages, or Java Archive
(JAR) files.
javaArray |
Construct Java array object |
import |
Add package or class to current import list |
javaclasspath |
Return Java class path or specify dynamic path |
javaaddpath |
Add entries to dynamic Java class path |
javarmpath |
Remove entries from dynamic Java class path |
javachk |
Error message based on Java feature support |
isjava |
Determine if input is Java object |
usejava |
Determine if Java feature is available |
javaMethod |
Call Java method |
javaMethodEDT |
Call Java method from Event Dispatch Thread (EDT) |
javaObject |
Call Java constructor |
javaObjectEDT |
Call Java constructor on Event Dispatch Thread (EDT) |
matlab.exception.JavaException |
Capture error information for Java exception |
How to call a Java object method in MATLAB.
Convert Java String to Uppercase
This example shows how to call a built-in Java String
class
method, toUpperCase
.
Use Class in Java JAR File on Static Class Path
This example shows how to call a class method in a Java Archive (JAR) file.
Call User-Defined Java Class on Dynamic Class Path
This example shows how to call a method in your own Java class.
This example opens a connection to a website specified by a URL to read text from a file at that site.
Find Internet Protocol Address Using java.net.InetAddress
This example returns the name or address of an IP host.
Create and Use Phone Book Using Java Classes
This example uses Java classesjava.io.FileOutputStream
, java.io.FileInputStream
,
and java.util.Hashtable
to create and modify a
list of names and numbers.
How you can benefit from using the MATLAB Java interface.
Bring Java Classes into MATLAB Workspace
How to use Java built-in, third party, or your own classes in MATLAB.
Construct and work with Java objects.
Calling syntax, static methods, and getting information about methods.
How MATLAB represents Java arrays and how to work with them.
How to pass MATLAB types to Java methods.
Handle Data Returned from Java Methods
How to handle types returned by Java methods.
How to adjust the Java heap size.