-1

I can't connect any of the above libraries. Here is my project folder: enter image description here

build.gradle file, enter image description here

import error picture enter image description here

and

IDEA's Project Structure dialog enter image description here

iraj jelodari
  • 3,118
  • 3
  • 35
  • 45
minmon
  • 18
  • 5
  • Do you have "org.jzu3d" added to Gradle repository? – y.bedrov Jan 01 '20 at 13:46
  • When you use Gradle you don't have to manually place the dependency JARs in your project directory. Simply specify the needed repositories and the appropriate dependency coordinates and Gradle will download the JARs from the repository into a customizable location on your computer. Gradle will then put those JARs on the classpath/modulepath as needed. If you absolutely need to manually add local JARs to your dependencies, then see [How to add local .jar file dependency to build.gradle file?](https://stackoverflow.com/q/20700053/6395627). – Slaw Jan 01 '20 at 23:08

1 Answers1

1

JZY3D

If you check the repository of the library at https://github.com/jzy3d/jzy3d-api, you will see different possible artifacts that you can use. Since you tagged your question with #javafx, I'd guess you need jzy3d-javafx.

If you search for it in the Maven repository, you will find the latest version available (1.0.2), and also an indication that this artifact is not available from MavenCentral, but from the jzy3D releases repository.

Therefore, in your build gradle you will need to include that repository and that dependency:

plugins {
  id 'application'
}

repositories {
    mavenCentral()
    maven {
        url "http://maven.jzy3d.org/releases"
    }
}

dependencies {
    implementation 'org.jzy3d:jzy3d-javafx:1.0.2'
}

mainClassName = "your.Main"

This is the result of running the JavaFX demo from the jyz3d repository:

jzy3d

However, I couldn't run that on Java 11, because some illegal reflective operations that lead to a runtime exception:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/Users/<user>/.gradle/caches/modules-2/files-2.1/org.jogamp.gluegen/gluegen-rt/2.3.2/edc35ccfc13d4a4ad02c50d580874c18bf48bbef/gluegen-rt-2.3.2.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

so this only runs for me with Java 8 (which is not a good sign...).

SurfacePlotter

This is the repository link: https://github.com/ericaro/surfaceplotter, and you can find it on MavenCentral: https://mvnrepository.com/artifact/net.ericaro/surfaceplotter/2.0.1

However, this is a very old release for Swing, so maybe you can manage to include it in a SwingNode..

JavaFX alternatives

If you want to plot surfaces with pure JavaFX 3D, running on Java 11+, you could also use SurfacePlotMesh from the FXyz library.

This question 3D surface JavaFX has a sample on how to use it.

Your build should be something like:

plugins {
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.8'
}

repositories {
    mavenCentral()
    maven {
        url = "http://maven.jzy3d.org/releases"
    }
}

dependencies {
    implementation 'org.fxyz3d:fxyz3d:0.5.2'
}

javafx {
    modules = [ 'javafx.controls' ]
}

mainClassName = 'your.Main'

FXyz3D

José Pereda
  • 44,311
  • 7
  • 104
  • 132