我从7.0.1更新到了Netbeans 8.0.1,如果禁用了"Web Start",我的java程序编译得很好。一旦启用"Web启动",我就会收到以下错误:
C:NetBeansProjectsSearchCriteriaEditornbprojectjnlp-impl.xml:480:
unsupported element customize
在jnlp-impl.xml文件的这一部分中:
<target name="-do-jar-jnlp-application" depends="-init-filename,-test-jnlp-type,-init-macrodef-copylibs" if="is.application+mkdist.available"> <j2seproject3:copylibs manifest="${tmp.manifest.file}"> <customize> <attribute name="Main-Class" value="${main.class}"/> </customize> </j2seproject3:copylibs> <echo>To run this application from the command line without Ant, try:</echo> <property location="${jnlp.dest.dir}/${jnlp.file}" name="jnlp.file.resolved"/> <echo>javaws "${jnlp.file.resolved}"</echo> </target>
据我所知,修复方法是:"将以下内容添加到自定义的junit宏定义中:"
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<customize/>
问题是我不知道它在哪里,也没有以任何方式修改我的蚂蚁文件。。。有人能给我更多的信息吗?我认为修复程序位于jnlp-impl.xml文件中的某个位置;我只是不知道该放在哪里。
编辑更新:在jnlp-impl.xml文件-中添加了所有引用"copylebs"的部分
<target name="-test-jnlp-type" depends="-test-jnlp-enabled" if="is.jnlp.enabled">
<condition property="is.applet">
<equals arg1="${jnlp.descriptor}" arg2="applet" trim="true"/>
</condition>
<condition property="is.application">
<equals arg1="${jnlp.descriptor}" arg2="application" trim="true"/>
</condition>
<condition property="is.component">
<equals arg1="${jnlp.descriptor}" arg2="component" trim="true"/>
</condition>
<condition property="is.applet+mkdist.available">
<and>
<isset property="libs.CopyLibs.classpath"/>
<istrue value="${is.applet}"/>
</and>
</condition>
<condition property="is.application+mkdist.available">
<and>
<isset property="libs.CopyLibs.classpath"/>
<istrue value="${is.application}"/>
</and>
</condition>
<condition property="is.component+mkdist.available">
<and>
<isset property="libs.CopyLibs.classpath"/>
<istrue value="${is.component}"/>
</and>
</condition>
</target>
......
<target name="-do-jar-jnlp-application" depends="-init-filename,-test-jnlp-type,-init-macrodef-copylibs" if="is.application+mkdist.available">
<j2seproject3:copylibs manifest="${tmp.manifest.file}">
<customize>
<attribute name="Main-Class" value="${main.class}"/>
</customize>
</j2seproject3:copylibs>
<echo>To run this application from the command line without Ant, try:</echo>
<property location="${jnlp.dest.dir}/${jnlp.file}" name="jnlp.file.resolved"/>
<echo>javaws "${jnlp.file.resolved}"</echo>
</target>
<target name="-do-jar-jnlp-component" depends="-test-jnlp-type,-init-macrodef-copylibs" if="is.component+mkdist.available">
<j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
</target>
提前谢谢。
<j2seproject3:copylibs
调用名称空间前缀为j2seproject3
的宏定义copylibs
。在构建文件中应该有一个位置定义copylibs
宏,其方式类似于(但不一定精确):
<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
上面的行在逻辑上应该存在于-init-macrodef-copylibs
目标内部,这也是customize
元素应该定义的地方。下面是基于我的一个示例NetBeans项目的片段。内容可能与您的内容不完全匹配,所以对我的回答持保留态度:
<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
... <!-- some attributes may be defined here first -->
<element name="customize" optional="true"/> <!-- customize should be defined here -->
<sequential>
...
<!-- somewhere in the macrodef -->
<copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
<fileset dir="${build.classes.dir}"/>
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
<customize/> <!-- this is where customize is used -->
</manifest>
</copylibs>
...
</sequential>
</macrodef>