2012-03-09 235 views
1

我將一個項目源從一臺PC轉移到另一臺。當我點擊Clean and Build Main ProjectRun菜單Netbeans的,我得到這個錯誤:在Netbeans中構建項目時出錯

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嗎?

回答

2

看起來好像原始機器安裝了JDK 7並且項目配置了該目標,但第二臺機器的版本較舊。

  • 您可以配置項目目標1.6或1.5,

  • 如果你需要JDK 7,那麼你就必須在第二臺機器上安裝它。
+0

非常感謝。 – SkyDrive 2012-03-09 09:07:08

1

正如madth3所說,問題在於項目構建目標版本。您導入的源是JDK7平臺的目標。您可以在系統上安裝JDK7,也可以將項目構建目標更改爲JDK 1.6。
要更改目標平臺,請右鍵單擊項目節點,選擇屬性,然後在屬性窗口的「sources」下,將「source/binary format」更改爲所需平臺

+0

非常感謝。 – SkyDrive 2012-03-09 09:06:54

相關問題