# To Call Embedded Spotfire Enterprise Runtime for R from an IntelliJ Project

Using the IntelliJ IDE to debug your Java application could require a workaround.

In one case, a user had problems using embedded TERR when debugging a Java application within the IntelliJ IDE, even when the application worked when invoked from Java directly. Specifically, evaluating the following:

    .JavaMethod("java/lang/Math", "pow", "(DD)D", 2, 3)

gave the correct answer, 8, whereas evaluating the following:

    .JavaMethod("com/tibco/terr/TerrJava", "testPow", "(DD)D", 2, 3)

resulted in the following Java error:

    java.lang.ClassNotFoundException: com.tibco.terr.TerrJava

Eventually, we discovered that IntelliJ uses a separate Java class loader when a project has a large classpath. This prevents `.JavaMethod` from finding the class `com/tibco/terr/TerrJava`. There is no clear way to work around this problem in TERR, because TERR cannot access IntelliJ's special class loader.

This problem is described in the article found at http://youtrack.jetbrains.com/issue/IDEA-48090?query=8, which also claims that this IntelliJ bug has been fixed.

In any case, this page also describes a workaround when using IntelliJ: remove the following line from the file workspace.xml:

    <property name="dynamic.classpath" value="true"/>