我正在将项目源从一台PC转移到另一台。当我点击Netbeans的Clean and Build Main Project
菜单中的Run
时,我收到了此错误:
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)
我该怎么办?我需要重新安装SDK吗?
答案 0 :(得分:2)
看起来好像原始机器安装了JDK 7并且项目已配置为目标,但第二台机器有旧版本。
或
答案 1 :(得分:2)
正如@ madth3所说,问题在于项目构建目标版本。您导入的源是JDK 7平台的目标。您可以在系统上安装JDK 7,也可以将项目构建目标更改为JDK 1.6。
更改目标平台: