Answers.Body: <p>I uninstalled <code>Java</code> the way it is written <a href="https://discussions.apple.com/thread/4772629" rel="nofollow noreferrer">here</a>:</p>
  
  <blockquote>
    <ol>
    <li>Click on the Finder icon located in your dock</li>
    <li>Click on Applications tab on the sidebar</li>
    <li>In the Search box enter JavaAppletPlugin.plugin</li>
    <li>This will find the JavaAppletPlugin.plugin file</li>
    <li>Right click on JavaAppletPlugin.plugin and select Move to Trash</li>
    </ol>
  </blockquote>
  
  <p>Then installed the recommended latest version for mac on the official <code>Java</code> website and it fixed the issue.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-16T23:21:36.050Z
Answers.LastActivityDate: 2018-07-17T18:27:15.260Z
Answers.LastEditDate: 2018-07-17T18:27:15.260Z
Answers.UserDisplayName: Nikita Vlasenko
Body: <p>I am trying to use the following <a href="https://www.bioconductor.org/packages/release/bioc/html/esATAC.html" rel="nofollow noreferrer"><code>ATACseq</code> pipeline</a>.</p>
  
  <p>Unfortunately when I am importing it with <code>library(esATAC)</code>, it is giving me an error:</p>
  
  <pre><code>Error: package or namespace load failed for ‘rJava’:
   .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
    Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
    Reason: image not found
  </code></pre>
  
  <p>There are threads that discuss similar problems <a href="https://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/" rel="nofollow noreferrer">1</a> and <a href="https://stackoverflow.com/questions/37735108/r-error-onload-failed-in-loadnamespace-for-rjava">2</a>:</p>
  
  <p>But I checked the Java version and it is the right one: <code>64bit</code>:</p>
  
  <pre><code>d-172-25-60-75:~ nikitavlasenko$ java -version
  java version "1.8.0_172"
  Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
  Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
  </code></pre>
  
  <p>I tried to do the following in <code>Rstudio</code>:</p>
  
  <pre><code>Sys.setenv(JAVA_HOME = "/usr/bin/java")
  library(rJava)
  library(esATAC)
  </code></pre>
  
  <p>But <code>library(rJava)</code> fails. I am using macOS High Sierra 10.13.4. I am not sure what can I try further. Any suggestions would be greatly appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-07-17T13:46:14.610Z
Comments.Text: Fundamentally, `JAVA_HOME` needs to be set to the Java *home*, not to the Java binary. This is a folder path that ends in `Home`.
Comments.UserDisplayName: Konrad Rudolph
Tags: <atac-seq>
Title: rJava issue when trying to use ATACseq pipeline
ThreadText: # rJava issue when trying to use ATACseq pipeline
  
  (Asked by: username_0 on 2018-07-16)
  
  I am trying to use the following [`ATACseq` pipeline](https://www.bioconductor.org/packages/release/bioc/html/esATAC.html).
  
  Unfortunately when I am importing it with `library(esATAC)`, it is giving me an error:
  
  ```
  Error: package or namespace load failed for ‘rJava’:
   .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so':
    dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/lib/server/libjvm.dylib
    Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava/libs/rJava.so
    Reason: image not found
  
  ```
  
  There are threads that discuss similar problems [1](https://www.r-statistics.com/2012/08/how-to-load-the-rjava-package-after-the-error-java_home-cannot-be-determined-from-the-registry/) and [2](https://stackoverflow.com/questions/37735108/r-error-onload-failed-in-loadnamespace-for-rjava):
  
  But I checked the Java version and it is the right one: `64bit`:
  
  ```
  d-172-25-60-75:~ username_0$ java -version
  java version "1.8.0_172"
  Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
  Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
  
  ```
  
  I tried to do the following in `Rstudio`:
  
  ```
  Sys.setenv(JAVA_HOME = "/usr/bin/java")
  library(rJava)
  library(esATAC)
  
  ```
  
  But `library(rJava)` fails. I am using macOS High Sierra 10.13.4. I am not sure what can I try further. Any suggestions would be greatly appreciated.
  
  **Tags:** atac-seq
  
  > **Comments:**
  > **username_1**: Fundamentally, `JAVA_HOME` needs to be set to the Java *home*, not to the Java binary. This is a folder path that ends in `Home`.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-07-16. Score: 0 | Accepted answer
  
  I uninstalled `Java` the way it is written [here](https://discussions.apple.com/thread/4772629):
  
  > 1. Click on the Finder icon located in your dock
  > 2. Click on Applications tab on the sidebar
  > 3. In the Search box enter JavaAppletPlugin.plugin
  > 4. This will find the JavaAppletPlugin.plugin file
  > 5. Right click on JavaAppletPlugin.plugin and select Move to Trash
  
  Then installed the recommended latest version for mac on the official `Java` website and it fixed the issue.
  
  
  ---
  
  