我正在将项目源从一台电脑转移到另一台电脑。当我从 Netbeans 的 Run
菜单中单击 Clean and Build Main Project
时,出现此错误:
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 吗?
最佳答案
看起来好像原始机器安装了 JDK 7 并且项目配置为目标,但第二台机器的版本较旧。
- 您可以将项目配置为目标 1.6 或 1.5,
或
- 如果您需要 JDK 7,则必须在第二台机器上安装它。
关于java - 在 Netbeans 中构建项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9629006/