Menu

#968 Java 11 support

v_6.x
closed
nobody
Java 11 (2)
5
2023-07-30
2020-07-02
VVD
No

Build error with openjdk 11:

Buildfile: /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-6.3-src/build.xml

build:
    [mkdir] Created dir: /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-6.3-src/build/classes
    [javac] /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-6.3-src/build.xml:47: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 2 source files to /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-6.3-src/build/classes
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.3
    [javac] error: Source option 1.3 is no longer supported. Use 6 or later.
    [javac] error: Target option 1.1 is no longer supported. Use 1.6 or later.

BUILD FAILED
/tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-6.3-src/build.xml:47: Compile failed; see the compiler error output for details.

Total time: 1 second
*** Error code 1

Run error with openjdk11 (build was with openjdk8):

июл. 02, 2020 4:58:00 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at com.eteks.sweethome3d.SweetHome3DBootstrap.main(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/media/j3d/GraphicsConfigTemplate3D
        at com.eteks.sweethome3d.SweetHome3D.addComponent3DRenderingErrorObserver(Unknown Source)
        at com.eteks.sweethome3d.SweetHome3D.init(Unknown Source)
        at com.eteks.sweethome3d.SweetHome3D.main(Unknown Source)
        ... 5 more
Caused by: java.lang.ClassNotFoundException: Class javax.media.j3d.GraphicsConfigTemplate3D
        at com.eteks.sweethome3d.tools.ExtensionsClassLoader.findClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at com.eteks.sweethome3d.tools.ExtensionsClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 8 more

Discussion

  • Emmanuel Puybaret

    The build errors make me think that you didn't build Sweet Home 3D with JDK 8.
    Probably a simple path error. I would uninstall JDK 11, build Sweet Home 3D with remaining JDK 8, and reinstall JDK 11 to run Sweet Home 3D with it.

     
  • VVD

    VVD - 2020-07-03

    It run fine on same host with openjdk8.
    (Tried rm -rf ~/.java before every start too).

     
  • Emmanuel Puybaret

    It runs with Java 11 too except under macOS at rhe moment.

     
  • VVD

    VVD - 2020-07-03

    What Java3D version do you use with OpenJDK 11?
    How did you compiled it with OpenJDK 11?
    I got error during build Java3D 1.5.2 with OpenJDK 11:

    cd /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath && /usr/bin/env JAVA_HOME=/usr/local/openjdk11 XDG_DATA_HOME=/tmp/work/usr/ports/java/java3d/work  XDG_CONFIG_HOME=/tmp/work/usr/ports/java/java3d/work  HOME=/tmp/work/usr/ports/java/java3d/work TMPDIR="/tmp" PATH=/tmp/work/usr/ports/java/java3d/work/.bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin NO_PIE=yes MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES ADDR2LINE="/usr/local/bin/addr2line" AR="/usr/local/bin/ar" AS="/usr/local/bin/as" CPPFILT="/usr/local/bin/c++filt" GPROF="/usr/local/bin/gprof" LD="/usr/local/bin/ld" NM="/usr/local/bin/nm" OBJCOPY="/usr/local/bin/objcopy" OBJDUMP="/usr/local/bin/objdump" RANLIB="/usr/local/bin/ranlib" READELF="/usr/local/bin/readelf" SIZE="/usr/local/bin/size" STRINGS="/usr/local/bin/strings" PREFIX=/usr/local  LOCALBASE=/usr/local  CC="cc" CFLAGS="-O2 -pipe  -fstack-protector-strong -fno-strict-aliasing "  CPP="cpp" CPPFLAGS=""  LDFLAGS=" -fstack-protector-strong -fuse-ld=bfd " LIBS=""  CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing  "  MANPREFIX="/usr/local" BSD_INSTALL_PROGRAM="install  -s -m 555"  BSD_INSTALL_LIB="install  -s -m 0644"  BSD_INSTALL_SCRIPT="install  -m 555"  BSD_INSTALL_DATA="install  -m 0644"  BSD_INSTALL_MAN="install  -m 444" /usr/local/bin/ant dist
    Buildfile: /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build.xml
    
    init:
        [mkdir] Created dir: /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build
    
    compile-opt:
        [mkdir] Created dir: /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build/opt/classes
        [mkdir] Created dir: /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build/opt/gen
        [javac] /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build.xml:106: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 47 source files to /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build/opt/classes
        [javac] warning: [options] bootstrap class path not set in conjunction with -source 5
        [javac] error: Source option 5 is no longer supported. Use 6 or later.
        [javac] error: Target option 1.5 is no longer supported. Use 1.6 or later.
    
    BUILD FAILED
    /tmp/work/usr/ports/java/java3d/work/java3d-1.5.2/vecmath/build.xml:106: Compile failed; see the compiler error output for details.
    
    Total time: 1 second
    *** Error code 1
    
    $ uname -srm
    FreeBSD 12.1-RELEASE-p6 amd64
    
     

    Last edit: VVD 2020-07-03
  • VVD

    VVD - 2020-07-03

    After replace several "1.5" with "1.6" I got error with "new sun.applet.AppletAudioClip(url)" - replaced it with "com.sun.media.sound.JavaSoundAudioClip.create(url) (https://bugs.openjdk.java.net/browse/JDK-8204454).
    Then few "dances" with ">" symbol in comments.
    But how to replace javah tag with javac in j3d-core/src/native/build.xml I don't know…

     
  • Emmanuel Puybaret

    Compiling requires JDK 5 to 8 and running it JDK or JRE 5 and above.

     
  • Emmanuel Puybaret

    • status: open --> closed
     
  • VVD

    VVD - 2020-07-29

    So closed it because it build with Java 11 now?
    Thanks!

     
  • Emmanuel Puybaret

    It runs with with Java 11 in your case, that what counts no?

     

    Last edit: Emmanuel Puybaret 2020-07-29
  • VVD

    VVD - 2020-07-29

    It runs with with Java 11 in your case, that what counts no?

    Ofc no.

    How did you install java3d in OpenJDK11?

     

    Last edit: VVD 2020-07-29
  • Emmanuel Puybaret

     

    Last edit: Emmanuel Puybaret 2020-07-29
  • VVD

    VVD - 2020-07-29

    I can't find answer on my question in README.TXT…
    Java3D install 4 files in OpenJDK8:
    /usr/local/openjdk8/jre/lib/amd64/libj3dcore-ogl.so
    /usr/local/openjdk8/jre/lib/ext/j3dcore.jar
    /usr/local/openjdk8/jre/lib/ext/j3dutils.jar
    /usr/local/openjdk8/jre/lib/ext/vecmath.jar
    If I run SweetHome3D with OpenJDK8 - it found all required files.
    But if I try to run with OpenJDK11 - it can't find Java3D files.

    Work fine:
    /usr/local/openjdk8/bin/java -Xmx1024m -jar /usr/local/share/java/classes/SweetHome3D-6.4.jar

    Doesn't work:
    /usr/local/openjdk11/bin/java -Xmx1024m -jar /usr/local/share/java/classes/SweetHome3D-6.4.jar

    Can I add some options to make SweetHome3D work with OpenJDK11?

     

    Last edit: VVD 2020-07-29
  • Emmanuel Puybaret

    Why would you install Java 3D? It's already provided with Sweet Home 3D.
    And sorry to insist, but why do you want to compile Sweet Home 3D?
    The SweetHome3D-6.4-linux-x64.tgz comes with a JRE 8 and Java 3D libraries, and if you want to run Sweet Home 3D with Java 11, you can run it with the Jar executable version which includes Java 3D too and with the command java -jar SweetHome3D-6.4.jar
    If the latest command doesn't work, you could add the option which forces the program to use an older version of Java 3D:
    java -Dcom.eteks.sweethome3d.j3d.version=1.5.2 -jar SweetHome3D-6.4.jar

     

    Last edit: Emmanuel Puybaret 2020-07-29
  • VVD

    VVD - 2020-07-29

    I'm using FreeBSD with native build of OpenJDK8/11 and SweetHome3D: https://svnweb.freebsd.org/ports/head/cad/sweethome3d/

     
  • Emmanuel Puybaret

    I updated the Ant script of Sweet Home 3D 6.5 to make it possible to build it with Java ≥ 9.

     
  • VVD

    VVD - 2023-07-30

    SweetHome3D 7.1, still can't build with OpenJDK 11:

    Buildfile: /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build.xml
    
    build:
         [echo] compiling Sweet Home 3D for Java 1.7 minimum version
        [mkdir] Created dir: /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build/classes
        [javac] /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build.xml:68: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 2 source files to /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build/classes
        [javac] warning: [options] bootstrap class path not set in conjunction with -source 7
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 1 warning
        [javac] /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build.xml:72: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
        [javac] Compiling 229 source files to /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build/classes
        [javac] warning: [options] bootstrap class path not set in conjunction with -source 7
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.
        [javac] Note: Some input files use unchecked or unsafe operations.
        [javac] Note: Recompile with -Xlint:unchecked for details.
        [javac] 1 warning
         [copy] Copying 496 files to /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build/classes
          [zip] Building zip: /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build/SweetHome3D.jar
       [delete] Deleting directory /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src/build/classes
    
    BUILD SUCCESSFUL
    Total time: 37 seconds
    cd /tmp/work/usr/ports/cad/sweethome3d/work/SweetHome3D-7.1-src && /usr/local/openjdk11/bin/javah -jni -o  src/com/eteks/sweethome3d/j3d/YafarayRenderer.h -cp  classes:lib/j3dcore.jar:lib/vecmath.jar:build/SweetHome3D.jar  com.eteks.sweethome3d.j3d.YafarayRenderer
    /bin/sh: /usr/local/openjdk11/bin/javah: not found
    *** Error code 127
    
     

Log in to post a comment.