Error while building project in Netbeans

邮差的信 提交于 2020-01-15 18:47:10

问题


I am transferring a project source from one pc to another. When I click Clean and Build Main Project from Run Menu of Netbeans, I got this error:

init:
deps-clean:
Updating property file: E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build\built-clean.properties
Deleting directory E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build
clean:
init:
deps-jar:
Created dir: E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build
Updating property file: E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build\built-jar.properties
Created dir: E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build\classes
Created dir: E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build\empty
Created dir: E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build\generated-sources\ap-source-output
Compiling 2 source files to E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\build\classes
javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options
E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\nbproject\build-impl.xml:605: The following error occurred while executing this line:
E:\Backup\My Documents (BackUp)\NetBeansProjects\AccountStatusChanger\nbproject\build-impl.xml:246: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)

what will I do? Do i need to reinstall the SDK?


回答1:


It looks as if the original machine has JDK 7 installed and the project was configured with that as the target, but the second machine has an older version.

  • You can configure the project to target 1.6 or 1.5,

or

  • If you need JDK 7 then you'll have to install it in the second machine.



回答2:


As @madth3 said, the problem is with the project build target version. The source you have imported is target for JDK 7 platform. Either you install JDK 7 on you system or change the project build target to JDK 1.6.

To change the target platform:

  1. Right click on the project node, select properties,
  2. Under "sources" in the properties window, change "source/binary format" to the desired platform


来源:https://stackoverflow.com/questions/9629006/error-while-building-project-in-netbeans

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!