Monday, July 30, 2018

Building a NetBeans project on a computer without Netbeans

When building a NetBeans project with ant on a computer without Netbeans, you have to pay attention to the following:
  • Be sure to have correct versions of org-netbeans-modules-java-j2seproject-copylibstask.jar. For example, if you are building with JDK6 but the copylibstask.jar is built with JDK7, you will get "Unsupported major.minor version 51.0" error.
  • Reference copylibstask.jar in ant.bat runAntNoClasspath section as follows: "-Dlibs.CopyLibs.classpath=%ANT_HOME%\extra\org-netbeans-modules-java-j2seproject-copylibstask.jar". If you don't do this in ant.bat and you have Netbeans installed, ant will look for copylibstask.jar in Netbeans install dir which means your build dependens on having Netbeans installed.
  • If you get "Class not found: javac1.8", it means you ant version is too old and not compatible with JDK8.
  • If your modules have forms, you need a copy of swing-layout jar file. This jar includes the org.jdesktop.layout.GroupLayout class.
  • You have to add dependencies to build.xml. These dependencies are specified in nbproject/project.properties in the javac.classpath section. Example:
  • If you want to embed libraries into main jar:

No comments: