Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

HJlib provides two jars for JDK8 and JDK7 compatibility. Installation instructions for both these are similar, except that the HJlib jar file needs to be different.
JDK8 installation instructions are mentioned first followed by instructions for JDK7support for multiple runtimes. In this article, we will discuss how to set up the JDK8 compatible cooperative runtime.
Instructions on the download and set up of the thread-blocking runtime is available in another article.


Table of Contents
indentTable of Contents

JDK8 compatible HJlib

Here are the steps for running HJlib on Java 8 using an IDE:

...

On Windows the environment variables have to be set up differently, refer to this stackoverflow question to see how it can be done.

 

Step 2: HJlib JAR File

Download the JDK8 compatible HJlib jar file and save it to a local directory.

...

Now we can run this program by right clicking on the HelloWorld item on the project explorer and clicking run.

Running the file on my machine produces the following output for example:

Image Removed

 

JDK7 compatible HJlib

A Java 7 compatible jar is available for download here: habanero-java-lib-0.1.2-SNAPSHOT-jdk7.jar

An IntelliJ project can be set up similar to the above instructions and the language level set to Java 7.

it for the first time will produce the following error:

Error occurred during initialization of VM
agent library failed to init: instrument

Java agents provide services that allow Java programming language agents to instrument programs running on the JVM. To run HJlib programs under the cooperative runtime we need to configure the JVM to use agents available in the HJlib jar. An agent is started by adding this option to the command-line:

-javaagent:jarpath[=options]

We need to configure this in IntelliJ to be able to successfully run HJlib programs. Below is an image of what the configuration looks like after editing the run configuration:

Image Added

Image Added

Now we can run the program by clicking on the green play button.
Running the file on my machine produces the following output for example:

Image Added

 Code examples of HJlib with JDK7 compatibility are available here: examples directory