Netbeans with Java 9 not creating /dis/lib

Viewed 1002

I have a project that is developed in netbeans using java 8. Now, I migrated to Java 9 and I am using a development version of netbeans. When I build the project using java 8 platform everything is OK and /dist/lib directory is created with the jars along with the project main jar file, but when I use java 9 platform only the project main jar is created and /dist/lib is not created. The build is successful and I can run the project in the IDE the problem is that when I run the project jar it's missing the library jars which are supposed to be in /dist/lib.

2 Answers

I think this is a bug in NetBeans. Reported in https://issues.apache.org/jira/browse/NETBEANS-1097

Meanwhile, you can fix it by editing nbproject\build-impl.xml by hand. Find this part:

<condition property="do.mkdist">
<and>
    <isset property="do.archive"/>
    <isset property="libs.CopyLibs.classpath"/>
    <not>
        <istrue value="${mkdist.disabled}"/>
    </not>
    <not>
        <istrue value="${modules.supported.internal}"/>
    </not>
</and>
</condition>

and delete this part:

    <not>
        <istrue value="${modules.supported.internal}"/>
    </not>

so that this remains:

<condition property="do.mkdist">
<and>
    <isset property="do.archive"/>
    <isset property="libs.CopyLibs.classpath"/>
    <not>
        <istrue value="${mkdist.disabled}"/>
    </not>
</and>
</condition>

Then it works as expected - until NetBeans recreates build-impl.xml...

Using NB 10. dist/lib does not get built on new projects. Above fix works, but I first have to create dist/lib.

Related