这是我第一次见到这个错误,我根本不知道如何修复它。错误是
run:
C:\Users\matt\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:48: Problem: failed to create task or type translate-classpath
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
BUILD FAILED (total time: 0 seconds)
我的代码是
package xj3dtest;
import java.awt.BorderLayout;
import java.awt.Container;
import static java.lang.Boolean.TRUE;
import javax.swing.JFrame;
import org.web3d.x3d.sai.*;
import java.util.HashMap;
public class Xj3DTest extends JFrame {
public Xj3DTest(String title) {
super(title);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Setup browser parameters
HashMap requestedParameters=new HashMap();
requestedParameters.put("Antialiased",TRUE);
requestedParameters.put("TextureQuality","medium");
requestedParameters.put("PrimitiveQuality","medium");
requestedParameters.put("Xj3D_InterfaceType","SWING");
requestedParameters.put("Xj3D_NavbarShown",TRUE);
requestedParameters.put("Xj3D_NavbarPosition","TOP");
requestedParameters.put("Xj3D_LocationShown",TRUE);
requestedParameters.put("Xj3D_LocationPosition","TOP");
requestedParameters.put("Xj3D_LocationReadOnly",TRUE);
requestedParameters.put("Xj3D_ShowConsole",TRUE);
requestedParameters.put("Xj3D_OpenButtonShown",TRUE);
requestedParameters.put("Xj3D_ReloadButtonShown",TRUE);
requestedParameters.put("Xj3D_StatusBarShown",TRUE);
requestedParameters.put("Xj3D_FPSShown",TRUE);
requestedParameters.put("Xj3D_ContentDirectory","CurrentDirectory");
requestedParameters.put("Xj3D_AntialiasingQuality","low");
requestedParameters.put("Xj3D_Culling_Mode", "frustum");
System.setProperty("x3d.sai.factory.class", "org.xj3d.ui.awt.browser.ogl.X3DOGLBrowserFactoryImpl");
BrowserFactory.setBrowserFactoryImpl(
new org.web3d.ogl.browser.X3DOGLBrowserFactoryImpl()
);
X3DComponent x3dComponent = BrowserFactory.createX3DComponent(requestedParameters);
Browser browser = x3dComponent.getBrowser();
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
cp.add((javax.swing.JPanel)x3dComponent, BorderLayout.CENTER);
X3DScene scene = browser.createX3DFromURL(new String[] {"test.x3d"});
browser.replaceWorld(scene);
}
public static void main(String[] args) {
Xj3DTest frame = new Xj3DTest("Xj3D test");
frame.setSize(640, 480);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
在run.xml
文件中,它是
<?xml version="1.0" encoding="UTF-8"?>
<project name="{0} (run)" default="run" basedir=".">
<target name="run">
<translate-classpath classpath="${classpath}" targetProperty="classpath-translated" />
<property name="run.jvmargs" value="" />
<property name="work.dir" value="${basedir}"/>
<property name="application.args" value="" />
<property name="java.failonerror" value="true"/>
<java classpath="${classpath-translated}" classname="${classname}" dir="${work.dir}" jvm="${platform.java}" fork="true" failonerror="${java.failonerror}">
<jvmarg value="-Dfile.encoding=${encoding}"/>
<redirector inputencoding="${encoding}" outputencoding="${encoding}" errorencoding="${encoding}"/>
<jvmarg line="${run.jvmargs}" />
<arg line="${application.args}" />
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</java>
</target>
</project>
第48行是<translate-classpath classpath="${classpath}" targetProperty="classpath-translated" />
,而我Jars
是
gluegen-rt
gluegen-rt-natives-linux-amd64
gluegen-rt-natives-windows-amd64
gluegen-rt-natives-windows-i586
j3d-core-1.3.1
jhall
joal
joal-natives-linux-amd64
joal-natives-windows-amd64
joal-natives-windows-i586
jogl-all
jogl-all-natives-linux-amd64
jogl-all-natives-windows-amd64
jogl-all-natives-windows-i586
xj3d.browser_2.1.0-nps
xj3d.cadfilter_2.1.0-nps
xj3d-2.1-3rdparty-nps
xj3d-2.1-nps
xj3d-core
xj3d-runtime
xj3d-script-base
我已使用项目属性中VM选项中的行Jars
将项目链接到包含所有-Xmx450M -Djava.library.path="C:\Users\matt\Documents\NetBeansProjects\jar"
的库,并且我已将库添加到库选项。
我真的不知道如何解决这个问题。
修改
它还没有修复。
答案 0 :(得分:0)
我有同样的问题,但有一个全新的项目。卸载并重新安装NetBeans为我修复了它。编译错误的同一个程序已成功编译并运行,因此我怀疑它与IDE相关而不是与代码相关。
答案 1 :(得分:0)
我在netbeans中启动了一个新项目,并创建了相同的类,并且它起作用了。它与代码无关。这是netbeans的错误。