5
votes

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
have you added the jars as a dependency on your app?MaVRoSCy
During migration, was your project migrated into another build/dependency system, EG Maven?Usagi Miyamoto
is there any APIs that are not accessible during execution ?Ahmad Sanie
what i would do is remove the jar folders from the dependencies, Do a Clean and Build. Close netbeans and re-add the jar files as Libraries.... Clean and build usually creates the dist folderMaVRoSCy
the most strange is that the jars are generated in /ib/dist using java 8 and not generated when using java 9m.y.m

2 Answers

4
votes

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...

0
votes

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