# To Call into Java from Spotfire Enterprise Runtime for R

terrJava and TERR work with Java in the same process.

When the terrJava package is loaded in TERR, a Java engine starts in the same process, if one is not already running. Using the `.JavaMethod` function, you can call any static Java method loaded in the Java engine, which can then run any Java code including Java UI operations (such as creating windows). You can use the `.JavaAttachClassPath` function to add new Java code at runtime, which you can then call via`.JavaMethod`. The `.JavaMethod` and `.JavaAttachClassPath` functions are both documented in the help pages for the terrJava package.