This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
1. I've used this java code: Properties properties = System.getProperties(); String name = "java.library.path"; System.out.println(name + "=" + properties.getProperty(name)); FileSystemProvider provider = DefaultFileSystemProvider.create(); FileSystem aDefault = FileSystems.getDefault(); Path path = new File("test", ".").toPath(); System.out.println("DONE"); 2. I've configured the Java Platform to be JDK 1.8 and pointed to /usr/local/openjdk8. Within the Poject Propertes on the tag Sources I used the Source format: JDK 8, Full JRE On the tab Libraries I've selected the JDK 1.8 Platform On the tab Run I can only select Project Platform 3. Compiling gives me: To run this application from the command line without Ant, try: /usr/local/openjdk8/bin/java -jar "/home/akruijff/NetBeansProjects/FileSystemProviderBug/dist/FileSystemProviderBug.jar" jar: BUILD SUCCESSFUL (total time: 0 seconds) 4. Running on the command line gives me: java.library.path=/usr/local/lib DONE 5. Running within NetBeans gives me: java.library.path=/usr/local/openjdk7/jre/lib/amd64:/usr/local/openjdk7/jre/lib/i386::/usr/local/lib Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/openjdk8/jre/lib/amd64/libnio.so: /usr/local/openjdk7/jre/lib/amd64/libnet.so: version SUNWprivate_1.1 required by /usr/local/openjdk8/jre/lib/amd64/libnio.so not defined 6. It should set the library path as: java.library.path=/usr/local/openjdk8/jre/lib/amd64:/usr/local/openjdk8/jre/lib/i386::/usr/local/lib 7. More information: Product Version = NetBeans IDE 8.0.2 (Build 201411181905) Operating System = FreeBSD version 10.1-STABLE running on amd64 Java; VM; Vendor = 1.7.0_80 Runtime = OpenJDK 64-Bit Server VM 24.80-b11
Created attachment 155224 [details] IDE log
Seems as a problem of the JDK 1.7.0_80 on BSD. The IDE does not set java.library.path unless the user does it in the project properties. The default value of the java.library.path should be taken from the ${DYLD_LIBRARY_PATH} and extended by the VM. It seems that for some reason the DYLD_LIBRARY_PATH contains the /usr/local/openjdk7/jre/lib/amd64. Unfortunately I cannot verify as I don't have FreeBSD, can you execute the following Java code both in NetBeans and command line using JDK 7 and attach the output: public static void main(String[] args) { System.out.printf("java.version = %s%n", System.getProperty("java.version")); System.out.printf("java.library.path = %s%n", System.getProperty("java.library.path")); System.out.printf("DYLD_LIBRARY_PATH = %s%n", System.getenv("DYLD_LIBRARY_PATH")); } Also the shell echo ${DYLD_LIBRARY_PATH} is needed. Thanks You can resolve the problem by adding the following VM Option into Project/Properties/Run: -Djava.library.path=/usr/local/lib
My original code works if I do this: --------------------------------------------------- cd /usr/local/openjdk7/jre/lib/amd64; mv libnet.so libnet.so.bak; ln -sv /usr/local/openjdk8/jre/lib/amd64/libnet.so Then it works. Of course now thereis a problem with JDK7 projects. The output you requested: --------------------------------------------------- java.version = 1.8.0_51 java.library.path = /usr/local/openjdk7/jre/lib/amd64:/usr/local/openjdk7/jre/lib/i386::/usr/local/lib DYLD_LIBRARY_PATH = null And the result of -Djava.library.path=/usr/local/lib --------------------------------------------------- No. I've tried al kinds of stuff with this option. I get the same exception again: Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/local/openjdk8/jre/lib/amd64/libnio.so: /usr/local/openjdk7/jre/lib/amd64/libnet.so: version SUNWprivate_1.1 required by /usr/local/openjdk8/jre/lib/amd64/libnio.so not defined I've also tried: -Djava.library.path=/usr/local/openjdk8/jre/lib/amd64:/usr/local/openjdk8/jre/lib/i386::/usr/local/lib And: -Djava.library.path=/usr/local/openjdk8/jre/lib/amd64 But that also doesn't work. Same exception. P.S. Using the VM option is hard for Maven projects
O and the Shell (tcsh): % echo ${DYLD_LIBRARY_PATH} DYLD_LIBRARY_PATH: Undefined variable. % echo $DYLD_LIBRARY_PATH DYLD_LIBRARY_PATH: Undefined variable.
Created attachment 155309 [details] JKD 8 Settings The settings used
Seems specific to FreeBSD. The -Djava.library.path should force the value of the "java.library.path" to the given value. I will need to download some FreeBSD VirtualBox image and try. One more question regarding to: >P.S. Using the VM option is hard for Maven projects The affected project is maven or ant? The java/project category is for ant based projects and I did testing on them. On maven it may be different. Thanks
The original application is a Maven project. I derived the simple code example from it. This is the basic NetBeans project type, so that does have a VM option. FreeBSD can be downloaded from here. https://www.freebsd.org/ I'm on KDE using kdm. An alternative might be: http://www.pcbsd.org/ I have never tried the latter, but the say that this is also FreeBSD.
Finally I installed the FreeBSD in VirtualBox. I can confirm the problem exists there.In fact the problem should happen on all UNIX Systems using LD_LIBRARY_PATH. Does not happen on OSX which uses DYLD_LIBRARY_PATH, this is the reason I was not able to reproduce it. You are right that the LD_LIBRARY_PATH is not set by JDK but by NetBeans. It's set by /usr/local/netbeans-8.0.2/platform/lib/nbexec. The environment is then inherited by child processes. On the project side there is a workaround - filter the value of the LD_LIBRARY_PATH but it's ugly solution and it will need to be done in Ant, Ant CoS, Maven, Maven CoS. As a workaround you can for now run NetBeans on JDK8 using: /usr/local/bin/netbeans-8.0.2 --jdkhome /usr/local/openjdk8
Tomas, thanks for the thorough evaluation. With no easy solution without side-effects this will not be hacked for 8.1. Please, use the workaround of running NetBeans on top of JDK8. Reassigning to Launcher. The section of nbexec setting LD_LIBRARY_PATH needs to be removed after 8.1 (when JDK7 support is dropped).
(In reply to Antonin Nebuzelsky from comment #9) > The section of nbexec setting LD_LIBRARY_PATH needs > to be removed after 8.1 (when JDK7 support is dropped). @Antonin Nebuzelsky: Now it is time to remove LD_LIBRARY_PATH! The trunk version is 8.2 and drops JDK7