Skip to main content

Java IDEs

Java IDEs

This section provides connection instructions for Visual Studio Code (with the Coding Pack for Java or the Java Extension Pack), Eclipse, IntelliJ, and NetBeans, which you can use to develop Java code that interacts with InterSystems IRIS using the InterSystems Native SDKOpens in a new tab and JDBCOpens in a new tab.

Visual Studio Code

To connect Visual Studio Code to InterSystems IRIS, use the following steps. (Log in to GitHub if necessary.)

  1. In your web browser, download or clone https://github.com/intersystems/Samples-java-helloworldOpens in a new tab.

  2. In Visual Studio Code, use File > Open Folder to open the folder you recently downloaded or cloned from GitHub.

  3. Select and open src/main/java.com.intersystems.samples.helloworld.java.

  4. Configure the username, password, IP address, and superserver port for your instance (see InterSystems IRIS Connection Information) in the variable declarations at the top of the main method. These values are used to construct the InterSystems JDBC connection string, in the form jdbc:IRIS://ipAddress:webserverPort/namespace, for example jdbc:IRIS://12.345.678.910:1972/USER.

  5. Use View > Terminal to open the terminal and execute the following commands:

    javac -cp ".:intersystems-jdbc-3.2.0.jar" HelloWorld.java
    java -cp ".:intersystems-jdbc-3.2.0.jar" HelloWorld
    
    
  6. The Output pane displays the message Hello World! You have successfully connected to InterSystems IRIS via JDBC.

Eclipse

To connect Eclipse to InterSystems IRIS, use the following steps. (Click Next to advance to the next panel of each dialog as needed.)

First, import the sample package,

  1. Select File > Import > Git > Projects from Git.

  2. Choose Clone URI. Copy and paste https://github.com/intersystems/Samples-java-helloworldOpens in a new tab into the URI field.

  3. Select the master branch, configure local storage, then choose Import existing Eclipse projects.

  4. Confirm the import by clicking Finish.

Next, update the sample code and run it.

  1. Open samples-java-helloworld > src > main.java.com.intersystems.samples > HelloWorld.java and make the following changes:

    1. Change the package declaration at the top to package main.java.com.intersystems.samples;.

    2. Configure the username, password, IP address, and port for your instance (see InterSystems IRIS Connection Information) in the variable declarations at the top of the main method. These values are used to construct the InterSystems JDBC connection string, in the form jdbc:IRIS://ipAddress:superserverPort/namespace, for example jdbc:IRIS://12.345.678.910:1972/USER.

  2. Run the code by selecting Run > Run.

  3. The Console tab displays the message Hello World! You have successfully connected to InterSystems IRIS via JDBC.

If you are not successful, confirm that the Java execution environment is set properly by doing the following:

  1. Right-click the samples-java-helloworld project in the Package Explorer pane and choose Build Path > Configure Build Path....

  2. On the Libraries tab, choose Add Library > JRE System Library > Execution environment > and choose an execution environment, such as JRE-1.1 (jre 1.8.0_172). Click Finish and then Apply and Close.

IntelliJ

To connect IntelliJ to InterSystems IRIS, use the following steps. (Click Next to advance to the next panel of each dialog as needed.)

First, create the sample project.

  1. Select VCS > Checkout from Version Control > Git.

  2. On the Clone Repository dialog,

    1. Copy and paste https://github.com/intersystems/Samples-java-helloworldOpens in a new tab into the Clone URI field.

    2. For the Directory field, enter the path to the location where you want the local GitHub repository created.

  3. Click Clone, then choose Yes in the popup to create a project based on this source.

Next, update the sample code and run it.

  1. Open src/main/java.com.intersystems.samples.helloworld.java and configure the username, password, IP address, and port for your instance (see InterSystems IRIS Connection Information) in the variable declarations at the top of the main method. These values are used to construct the InterSystems JDBC connection string, in the form jdbc:IRIS://ipAddress:superserverPort/namespace, for example jdbc:IRIS://12.345.678.910:1972/USER.

  2. In the Project pane, right-click HelloWorld.java and choose Run ‘HelloWorld.main()’.

  3. The Output pane displays the message Hello World! You have successfully connected to InterSystems IRIS via JDBC.

If you are not successful, confirm that the Java execution environment is set properly by doing the following:

  1. Choose Build Path > Build Project.

  2. Edit the configuration and add a new application configuration, selecting com.intersystems.samples.HelloWorld for the main class.

  3. If the error Error:java: invalid source release: 9 is displayed, change the project SDK and project language level to 1.8 in the following locations:

    • File > Project Structure > Project Settings

    • File > Project Structure > Module Settings > Sources: Language Level tab

    • File > Project Structure > Module Settings > Dependencies: Module SDK tab

NetBeans

To connect NetBeans to InterSystems IRIS, use the following steps. (Click Next to advance to the next panel of each dialog as needed.)

First, create the sample project.

  1. Select Team > Git > Clone.

  2. Copy and paste https://github.com/intersystems/Samples-java-helloworldOpens in a new tab into the Repository URL field.

  3. Select Master as the branch to be fetched, choose the location where you want the local GitHub repository to be created, and click Finish.

Next, update the sample code and run it.

  1. Open HelloWorld.java and configure the username, password, IP address, and port for your instance (see InterSystems IRIS Connection Information) in the variable declarations at the top of the main method. These values are used to construct the InterSystems JDBC connection string, in the form jdbc:IRIS://ipAddress:superserverPort/namespace, for example jdbc:IRIS://12.345.678.910:1972/USER.

  2. In the Project pane, open the Dependencies folder, then right-click intersystems-jdbc-3.0.0.jar and choose Manually install artifact. Navigate to the folder you recently cloned, select intersystems-jdbc-3.0.0.jar, and click Install Locally.

  3. In the Project pane, right-click HelloWorld.java and choose Run File.

  4. The Output pane displays the message Hello World! You have successfully connected to InterSystems IRIS via JDBC.

FeedbackOpens in a new tab