# Java extension

**URL:** <https://forum.knime.com/t/java-extension/12003>\
**Category:** KNIME Extensions\
**Created:** [September 6, 2018, 2:00pm UTC](https://forum.knime.com/t/java-extension/12003 "2018-09-06T14:00:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iosif\_Tanasescu](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@Iosif\_Tanasescu](https://forum.knime.com/u/Iosif_Tanasescu)\
**Post date:** [September 6, 2018, 2:00pm UTC](https://forum.knime.com/t/java-extension/12003/1 "2018-09-06T14:00:47Z")

</div>

Hi

I’m trying to read dynamically a “table”/“frame” via a Java program.  
The program return String with first row column names.

I was successful using R node integration and rJava

 ![Knime1](https://forum-cdn.knime.com/uploads/default/original/2X/c/ca970a2118ad9d6dd98bc55c8d567f8eaf9c2b59.png)

Below is a sample:

 ![Knime2](https://forum-cdn.knime.com/uploads/default/original/2X/5/5c44ded6297eed480e3787d31a0919006883fb29.png)  
As within 3.6.1, R 341 and JDK 8.171 cannot execute with errors in rJava load (rJava.ddl on Windows nor rJava.so on Linux, none works).

So I’ve changed to a Java Script node,  
The equivalent code is

String boxa = ca.g…SiebelUtilities.getRepositoryBC() ;

However I can’t use something like above  
knime.out = boxa  
in order to pass the dynamically the whole table further down to the workflow

a) I can manipulate individually some columns and return as collections, then process, but is not general (not dynamic)  
Sample with only two columns

 ![Knime3](https://forum-cdn.knime.com/uploads/default/original/2X/4/4f17d174b152b58a81e9314711ceb8a17e11a820.png)

Comparison of output

 ![Knime5](https://forum-cdn.knime.com/uploads/default/original/2X/3/378ee34a179867356097e3296835c48f926ad754.png)  
b) I try to write to an intermediate file (or database), but still not dynamic at the read time  
 ![Knime4](https://forum-cdn.knime.com/uploads/default/original/2X/3/36ebcbb49a76ee5a7bba69b24e583db900b46a92.png)  
Any idea ?

---

<div class="post-metadata">

**Author:** ![marten\_kose](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marten\_kose](https://forum.knime.com/u/marten_kose)\
**Post date:** [September 18, 2018, 4:35pm UTC](https://forum.knime.com/t/java-extension/12003/2 "2018-09-18T16:35:29Z")

</div>

Before going for the workaround, let us investigate on why your initial solution using rJava does not work anymore. What are the error messages you get? And for which versions it worked before?

---

<div class="post-metadata">

**Author:** ![Iosif\_Tanasescu](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@Iosif\_Tanasescu](https://forum.knime.com/u/Iosif_Tanasescu)\
**Post date:** [September 19, 2018, 5:45pm UTC](https://forum.knime.com/t/java-extension/12003/3 "2018-09-19T17:45:32Z")

</div>

Hi Marten

I would like to thank you first for your interest.  
Based on your request, I was able to push and debug why was no longer working.  
And I’ve succeeded make-it working again on Windows only, in the following combinations  
a) Knime 3.6.1 / R 3.4.1  
From within the workflow, the Java\_home and R version

 ![Knime10](https://forum-cdn.knime.com/uploads/default/original/2X/d/d159aea0e471b96970eda650a9ddb22eb128f81a.png)  
Knime version  
 ![Knime9](https://forum-cdn.knime.com/uploads/default/original/2X/7/7019bfa0159561fdebace287d5e7ea719ef79319.png)

How knime is start (note that PATH has been overwritten, as it was included a path to a java 32 bits which caused errors !

 ![Knime7](https://forum-cdn.knime.com/uploads/default/original/2X/e/edcbea8f96c1e6b7ac822efbc324eb62c7810892.png)  
Details of execution (with success table…)  
 ![Knime8](https://forum-cdn.knime.com/uploads/default/original/2X/6/6d045888e0207d33933312109b6b5743e22d7b90.png)

b) Also, works with Knime 3.4.2 and R 3.3.0

 ![Capture](https://forum-cdn.knime.com/uploads/default/original/2X/3/3f410aafdd086e63da4adf7b93122fced6189a96.png)

c) However, it doesn’t work on Linux !  
Knime 3.6.0, R 3.5.1

 ![Knime11](https://forum-cdn.knime.com/uploads/default/original/2X/2/2a8b0bb12548465ff75755b9b3f11c5a2987dc99.png)

d) Also note that from Linux and pure R, the library is loaded correctly

 ![Knime12](https://forum-cdn.knime.com/uploads/default/original/2X/9/90c9d10effd550c2b7e20b2a3f3f97f95dfa7292.png)

---

<div class="post-metadata">

**Author:** ![marten\_kose](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marten\_kose](https://forum.knime.com/u/marten_kose)\
**Post date:** [September 20, 2018, 11:52am UTC](https://forum.knime.com/t/java-extension/12003/4 "2018-09-20T11:52:45Z")

</div>

Thanks to your detailed description I was able to reproduce the issue. The steps from this [discussion](https://askubuntu.com/questions/584529/libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory) helped me to get it running:

1. Find your R location. It will be stored in `rsession-ld-library-path` in `rserver.conf` file. Or just by doing `which R` . The location usually is `/usr/lib64/R/lib` or `/usr/lib64/microsoft-r/3.3/lib64/R/lib`
2. Find the `libjvm.so` file which is usually in the `usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server` path depending on which jre you’re using. Check `echo $JAVA_HOME` .
3. Create a symlink using `ln -s``sudo ln -s /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so /usr/lib64/microsoft-r/3.3/lib64/R/lib/libjvm.so`

Does that help?

---

<div class="post-metadata">

**Author:** ![Iosif\_Tanasescu](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@Iosif\_Tanasescu](https://forum.knime.com/u/Iosif_Tanasescu)\
**Post date:** [September 20, 2018, 2:10pm UTC](https://forum.knime.com/t/java-extension/12003/5 "2018-09-20T14:10:18Z")

</div>

We are getting there …

Following your suggestion, now the library rJava loads !  
_sudo ln -s /spss/InstallSoftware/ibm-java-x86\_64-80/jre/lib/amd64/classic/libjvm.so /opt/microsoft/ropen/3.5.1/lib64/R/lib/libjvm.so_

However the execution fails at jinit phase

 ![Knime13](https://forum-cdn.knime.com/uploads/default/original/2X/3/313ea09c77929dd90e0a94be770cb1520faf45ea.png)

From the knime.log, the associate message is the following

 ![Knime15](https://forum-cdn.knime.com/uploads/default/original/2X/e/e5160055923d38672418edbd7b33aac0f81b86d1.png)

At the console, the error is as follows:

 ![Knime16](https://forum-cdn.knime.com/uploads/default/original/2X/b/b457b4489a23f90ad2246f2e59ccbd695933c96b.png)  
Note that from R perspective (and Rserve ?) “regular” nodes execute successfully in Knime (Linux); below a screen shot which is OK  
 ![Knime14](https://forum-cdn.knime.com/uploads/default/original/2X/9/9ecfde77c39efd39b0f7f3b074bf33fe1e10954b.png)

On a final note, I did try executing knime as sudo  
sudo ./knime &  
with the same results as a “regular” user

---

<div class="post-metadata">

**Author:** ![marten\_kose](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@marten\_kose](https://forum.knime.com/u/marten_kose)\
**Post date:** [September 20, 2018, 3:07pm UTC](https://forum.knime.com/t/java-extension/12003/6 "2018-09-20T15:07:45Z")

</div>

Even though your Rserve seems to work properly (as some R nodes execute successfully), you might want to check the version of your Rserve package and in case it is below 1.8-6, try installing it via install.packages(‘Rserve’,“[http://rforge.net/",type="source](http://rforge.net/%22,type=%22source)”) [like it is suggested in another thread](https://forum.knime.com/t/r-snippets-rserve-version-warnings/12059).

---

<div class="post-metadata">

**Author:** ![Iosif\_Tanasescu](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/i/b3f665/32.png) [@Iosif\_Tanasescu](https://forum.knime.com/u/Iosif_Tanasescu)\
**Post date:** [September 26, 2018, 6:15pm UTC](https://forum.knime.com/t/java-extension/12003/7 "2018-09-26T18:15:38Z")

</div>

Hi

Finally I was able to install the latest version of Rserve, a.k.a. 1.8.6  
Note that it needed openssl-devel in order to install (the previous version used, 1.7.3 didn’t needed !)  
The latest test result is as follows:

 ![Knime17](https://forum-cdn.knime.com/uploads/default/original/2X/4/40e56273ef8bf0e58ebf659ab1b2e08787edb47b.png)

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [June 23, 2023, 8:30pm UTC](https://forum.knime.com/t/java-extension/12003/8 "2023-06-23T20:30:46Z")

</div>


