/
Launch Online IDE

Prepare your computer

Install Java, IDE, Corda


You need a number of tools before you can start working on your CorDapp. In this section, you will install a minimal set. You can rely on project configurations to download the rest of the dependencies.

CorDapps (Corda Distributed Apps) are pieces of Java bytecode, so you will need at least a passing familiarity with this language.

In this section, you will:

  • Download and install a minimal suite of required tools.
  • Check and correct your Java version to Java8.
  • Access the Corda Git repository constellation.
  • Take a look at new Corda release snapshots.
  • Trouble shoot your setup.

This section is an essential requirement if you want to complete the hands-on coding without a hitch. Even seasoned coders should go through this list and check they have the required minimum setup.

Tooling

Find a thorough guide here. The following is the minimal setup to get started:

  • Oracle JDK: This is important. Be sure to install the Oracle JDK version 8 (not the JRE) at version 8u171 or higher. If you have a newer version of Java installed, you need to install version 8 alongside your newer version. Below, and later in the course, you will see how you can point Corda to the desired version.
  • IDE: You may use any Java-able IDE you like. IntelliJ IDEA Community Edition is this training's first choice and it will be used throughout. In a later section, you will be introduced to Visual Studio Code; not the Web version.
  • Git: As you may have guessed already, Git is used for source control. If it is not already part of your system, download and install for your OS. If your OS isn't supported, your workaround is to download repositories as Zip files.
  • Gradle: Corda uses the Gradle build system. However, you do not need to install anything. You will use the IDE's project commands which will download it as necessary.
  • Kotlin: Corda itself is written in Kotlin which has excellent Java interoperability. CorDapps can be written in Kotlin as well. IntelliJ comes with support for Kotlin so you do not need to install anything extra.

Java versions

Corda requires Java8, so if you have a more recent version installed, it will likely be the default, potentially causing problems such as:

 INFO Cannot initialize scripting support because this JRE does not support it. java.lang.NoClassDefFoundError: javax/script/ScriptEngineManager

In case this is relevant, now or in the future, let's collect the different ways available to overcome such hurdles.

  1. If you want to run a Java JAR with a different Java version, you can do:

    $ /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home/bin/java -jar corda.jar

    Where you put the jdk1.8.0_xxx.jdk path that works for you.

  2. If you want to run a script once with a different JAVA_HOME, you can do:

    $ JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home YOUR_SCRIPT

    Where you put the jdk1.8.0_xxx.jdk path that works for you.

  3. If you want to run a Gradle command once with a different java.home:

    $ ./gradlew -Dorg.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home build

    Where you replace the path and the command as desired.

  4. If you want to do the same for Gradle when launched by double-click from IntelliJ, you open the Gradle Settings

    Gradle settings button
    Gradle settings button
    and select the desired version in the drop-down:

    Pick JVM for Gradle
    Pick JVM for Gradle

Corda repository constellation

R3 has created many repos on Github, with the most important ones at this stage of your journey being:

  • samples-java: if you are looking for a code example, or a way to do something, an example can probably be found there.
  • samples-kotlin: the same but in Kotlin.
  • corda: is the open-source Corda platform code.
  • corda-template-java / kotlin: simple project scaffolds to help you get started.

Snapshots and Releases

The Corda team merges ongoing work into snapshots that may be unstable. Generally, unless you have a very good reason for needing to use a snapshot version or a release candidate, the more cautious approach is to run with major releases which you can find here.

You will see releases marked “M” for milestone and “RC” for release candidates; the official releases generally include a changelog. For example, at the time of writing, the most current stable release was Corda 4.3.

Troubleshoot

IntelliJ's own JDK

It is highly unlikely, but if, at a later stage, you encounter the following:

The newly created daemon process has a different context than expected.
Java home is different.
Expecting: '/Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home' but was: '/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home'.
Please configure the JDK to match the expected one.
Open JDK Settings

You need to change the boot SDK. Note that the fix, may have to be called slightly differently from the help page above: Help / Find Action / Switch Boot JDK:

Call Switch Boot JDK Action
Call Switch Boot JDK Action

Apply Boot JDK Version
Apply Boot JDK Version

Weird missing dependencies

It might happen that IntelliJ and / or Gradle would say that a dependency is missing, and you have looked around a lot and nothing makes sense. In this rare case, in IntelliJ, consider doing File -> Invalide Caches / Restart....

Discuss on Slack
Rate this Page
Would you like to add a message?
Submit
Thank you for your Feedback!