2014-01-14 54 views
-1

我更好地從一開始就解釋情況。我想換一個.jar文件的分辨率,所以我Java Decompiler反編譯,然後我去了記事本+ +和做了一個小編輯,在2號線爲.java文件:java - 如何用Eclipse或NetBeans編譯一個沒有錯誤的java文件?

paramGraphics.setClip(0, 0, 176, 208); 

這樣:

paramGraphics.setClip(0, 0, 320, 240); 

和:

paramGraphics.setClip(0, 0, 176, 208); 

這樣:

paramGraphics.setClip(0, 0, 320, 240); 

然後保存。之後,我想將該文件編譯到一個類中。我嘗試使用javac命令,沒有工作,並顯示100錯誤。它沒有編譯。十個使用的NetBeans。相同的結果,它沒有編譯。

這是NetBeans中的編譯器輸出:

ant -f "C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4" -Dnb.internal.action.name=rebuild clean jar init: deps-clean: Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build Updating property file: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\built-clean.properties Deleting directory C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build clean: init: deps-jar: Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build Updating property file: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\built-jar.properties Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\classes Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\empty Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\generated-sources\ap-source-output Compiling 1 source file to C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\build\classes C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:4: error: cannot find symbol public Image jdField_int; symbol: class Image location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:18: error: cannot find symbol public a(InputStream paramInputStream) symbol: class InputStream location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:61: error: cannot find symbol public void jdField_if(Graphics paramGraphics) symbol: class Graphics location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:70: error: cannot find symbol public void a(Graphics paramGraphics) symbol: class Graphics location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:47: error: cannot find symbol this.jdField_int = Image.createImage(this.jdField_do, 0, this.jdField_do.length); symbol: variable Image location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:76: error: cannot find symbol int k = j + b.bD + this.jdField_new[this.jdField_else] + 16; symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:77: error: cannot find symbol int m = i + b.bF + 16; symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:78: error: cannot find symbol int n = i + b.bF + this.jdField_try[this.jdField_else] + 16; symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:79: error: cannot find symbol int i1 = e.jdField_if(m, k); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:80: error: cannot find symbol int i2 = e.jdField_if(n, k); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:83: error: cannot find symbol i3 = e.jdField_if(n, k); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:85: error: cannot find symbol i3 = e.jdField_if(m + 16, k); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:88: error: cannot find symbol i4 = e.jdField_if(m, k); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:90: error: cannot find symbol i4 = e.jdField_if(n - 16, k); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:91: error: cannot find symbol int i5 = e.jdField_if(m, k - 16); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:92: error: cannot find symbol int i6 = e.jdField_if(n, k - 16); symbol: variable e location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:100: error: cannot find symbol paramGraphics.setClip(i, j, this.jdField_try[this.jdField_else], this.jdField_new[this.jdField_else] - i7 - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF)); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:107: error: cannot find symbol paramGraphics.setClip(i + 16 + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 32 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:107: error: cannot find symbol paramGraphics.setClip(i + 16 + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 32 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:107: error: cannot find symbol paramGraphics.setClip(i + 16 + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 32 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:107: error: cannot find symbol paramGraphics.setClip(i + 16 + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 32 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:112: error: cannot find symbol paramGraphics.setClip(i + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:112: error: cannot find symbol paramGraphics.setClip(i + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:112: error: cannot find symbol paramGraphics.setClip(i + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:112: error: cannot find symbol paramGraphics.setClip(i + (16 - (i + b.bF & 0xF)), j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 + (i + b.bF & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:119: error: cannot find symbol paramGraphics.setClip(i, j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 - (i + b.bF + this.jdField_try[this.jdField_else] & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:119: error: cannot find symbol paramGraphics.setClip(i, j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 - (i + b.bF + this.jdField_try[this.jdField_else] & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:119: error: cannot find symbol paramGraphics.setClip(i, j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - 16 - (i + b.bF + this.jdField_try[this.jdField_else] & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:124: error: cannot find symbol paramGraphics.setClip(i, j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - (i + b.bF + this.jdField_try[this.jdField_else] & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:124: error: cannot find symbol paramGraphics.setClip(i, j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - (i + b.bF + this.jdField_try[this.jdField_else] & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\src\javaapplication4\a.java:124: error: cannot find symbol paramGraphics.setClip(i, j + this.jdField_new[this.jdField_else] - (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) - i7, this.jdField_try[this.jdField_else] - (i + b.bF + this.jdField_try[this.jdField_else] & 0xF), (j + b.bD + this.jdField_new[this.jdField_else] & 0xF) + i7); symbol: variable b location: class a 31 errors C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\nbproject\build-impl.xml:920: The following error occurred while executing this line: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication4\nbproject\build-impl.xml:260: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 2 seconds)

我怎樣才能重新編譯我的文件上課嗎?我對Java不太瞭解,所以我是一個新手。誰能幫我?

在此先感謝


更新!

這是現在的輸出日誌...

ant -f "C:\\Users\\USER\\Mis documentos\\NetBeansProjects\\JavaApplication5" -Dnb.internal.action.name=rebuild clean jar 
init: 
deps-clean: 
Updating property file: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build\built-clean.properties 
Deleting directory C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build 
clean: 
init: 
deps-jar: 
Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build 
Updating property file: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build\built-jar.properties 
Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build\classes 
Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build\empty 
Created dir: C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build\generated-sources\ap-source-output 
Compiling 8 source files to C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\build\classes 
C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\src\javaapplication5\Dun.java:22: error: <identifier> expected 
     a.char = true; 
C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\src\javaapplication5\Dun.java:22: error: not a statement 
     a.char = true; 
C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\src\javaapplication5\Dun.java:22: error: illegal start of expression 
     a.char = true; 
C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\src\javaapplication5\Dun.java:22: error: ';' expected 
     a.char = true; 
4 errors 
C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\nbproject\build-impl.xml:920: The following error occurred while executing this line: 
C:\Users\USER\Mis documentos\NetBeansProjects\JavaApplication5\nbproject\build-impl.xml:260: Compile failed; see the compiler error output for details. 
BUILD FAILED (total time: 0 seconds) 
+3

刪除所有錯誤。添加所有依賴項。 –

+1

你必須給所有依賴於它,或者它會更清楚,我當u發表您的錯誤,有 – Tenacious

+0

我打賭,所有的(大部分)你的錯誤是由於缺少資源。至少,您需要讓您的'javac'命令訪問任何其他需要可用的JAR和資源才能構建它。如果你的反編譯器爲你提供了導入名稱,這些包應該給你一個線索。這是一個完整的自定義構建,並且超出了本網站的範圍。 –

回答

2

我的朋友編譯任何IDE,它會顯示你的錯誤,然後相應地由該類添加所需的資源,你的代碼,然後嘗試運行它。

+0

好的,我在開篇文章中添加了編譯器輸出。 – user1903782

+0

@ user1903782這些錯誤很明顯,他們顯示各種資源都缺少這就是爲什麼我的朋友這個「無法找到符號」錯誤的各種資源已被編譯器拋出像前例:對於「類圖形位置:」,因爲你還沒有解決通過添加所需的jar到你的類路徑 – Tenacious

+1

@ user1903782下載並將此jar添加到你的classpath http://www.java2s.com/Code/Jar/j/Downloadjavartjarstubs150jar。htm – Tenacious

2

你需要有所有罐子Y,它的作者用來編譯提供的jar X原班/罐X.是自給自足(即它不依賴於像Y這樣的外部jar),那麼你可以將原來的X添加到類路徑中,然後再次嘗試編譯修改過的類/ jar X(包括所做的更改)。但現在幾乎沒有罐子是自給自足的,所以你可能沒有多少運氣。你只需要知道這是作者在編譯時用於生產瓶子X的所有依賴