简体   繁体   中英

how to use surface plotter or jzy3d with Intellij idea and gradle and javafx

I can't connect any of the above libraries. Here is my project folder: 在此处输入图片说明

build.gradle file, 在此处输入图片说明

import error picture在此处输入图片说明

and

IDEA's Project Structure dialog 在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM