无法构建Java Netbeans项目

时间:2016-10-09 10:40:58

标签: java netbeans build

几天前,我对构建项目没有任何问题。但突然间我无法访问lib目录(SchoolManagement / SchoolManagement / dist / lib)。我甚至无法删除lib目录。它显示错误"访问被拒绝!"。

输出日志显示:

    ant -f C:\\Users\\Dinesh\\Dropbox\\SchoolManagement\\SchoolManagement -   Dnb.internal.action.name=rebuild clean jar
    init:
    deps-clean:
    Deleting directory    C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build
    clean:
    init:
    deps-jar:
    Created dir: C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build\classes
    Created dir: C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build\empty
    Created dir: C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build\generated-sources\ap-source-output
    Compiling 14 source files to C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build\classes
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Copying 2 files to C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build\classes
compile:
    Copying 1 file to C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\build
    Copy libraries to C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\dist\lib.
C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\nbproject\build-impl.xml:993: The following error occurred while executing this line:
C:\Users\Dinesh\Dropbox\SchoolManagement\SchoolManagement\nbproject\build-impl.xml:837: 
java.lang.NullPointerException
    at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:439)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:519)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:480)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:443)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:409)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:384)
    at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:322)
    at org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs.execute(CopyLibs.java:206)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 28 seconds)

1 个答案:

答案 0 :(得分:1)

首先我们可能需要查看确切的代码行,因为存在空指针错误,但是可能是由于无法访问您的目录,具体取决于Netbeans对C:/驱动器的权限。

可能的解决方案

如果Netbeans无法删除目录,您可能希望尝试以管理员身份运行netbeans以获得所需的权限(右键单击并以管理员身份运行),然后它可能会起作用。似乎还有一个空指针异常,但这可能是因为缺少权限

其他解决方案

由于这是一个学校项目,如果你在学校的计算机上运行我会在某种程度上假设他们可能已经给你一个没有提升权限的帐户,这可能是问题,你可以试试手动将文件复制到您的帐户具有读/写权限的新位置。