Code Monkey home page Code Monkey logo

Comments (6)

leifeld avatar leifeld commented on July 23, 2024

Thanks for reporting this. I'll look into it in the next weeks.

I think it may be a MacOS issue and should also happen in server environments without graphical capabilities (i.e., a remote server shell). The reason might be that Java AWT components like the java.awt.color class are used in the code accessed by R.

If you require an immediate solution, you can try running it on a non-Mac computer or in RStudio Cloud.

from dna.

fchavesco avatar fchavesco commented on July 23, 2024

Thanks for the help! I've tried to run it on RStudio cloud and received this problem:

dna_init()
Jar file found in library path.
Jar file: /cloud/lib/x86_64-pc-linux-gnu-library/4.2/rDNA/inst/java/dna-3.0.9.jar
Error in dna_init() :
java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE

from dna.

leifeld avatar leifeld commented on July 23, 2024

This indicates that rDNA has an old jar file version lying around in the library path. It's attempting to use that one instead of the one you have in your working directory. Make sure you use the current 3.0.10 version of both DNA and rDNA and, if necessary, delete the 3.0.9 jar file from the path indicated in the error message. It could be caused by a prior installation of rDNA 3.0.9, for example.

from dna.

leifeld avatar leifeld commented on July 23, 2024

If you are sure that you have rDNA 3.0.10 installed and deleting the file does not help, you can also set the relative or absolute path of the jar file you intend to use as an argument in your dna_init call.

from dna.

leifeld avatar leifeld commented on July 23, 2024

This issue was fixed in commit 1906b0c and will be part of the next DNA release 3.0.11.

The problem was that rDNA called the Exporter Java class in DNA, which in turn relied on the java.awt.Color class like many other parts of DNA to save colours of coders, statements, regexes etc. The Color class, however, depends on the graphics output system X11 to work. On some systems, such as HPC servers, X11 is not available. In such cases, rDNA throws a java.awt.HeadlessException. Headless means there is no X11 graphics system although the code calls for it (via the Color class as mentioned above).

For some reason, when you install the rJava R package on MacOS, it throws a warning about not being able to load the X11 libraries for compiling rJava. It's not preventing users from installing rJava, but apparently any code that requires X11 doesn't work in that case, so the result is the same as on a server without X11, such as a Linux server. As rDNA depends in rJava, this effectively led rDNA to throw the java.awt.HeadlessException on MacOS as well.

In the commit, I replaced all those instances of java.awt.Color throughout DNA with a new, rewritten Color class. I wrote this as a light-weight container that simply contains RGB values and can be converted to a java.awt.Color object when needed. With this replacement, it works on MacOS as well as Linux servers now; I have tested it on both.

from dna.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.