2014-05-03 107 views
0

我對工作的修改存在的開源項目如何修改src文件並重新編譯,在eclipse中生成一個jar文件?

它,它調用ProGuard的,在項目它有一個src文件夾

http://sourceforge.net/projects/proguard/files/proguard/4.11/proguard4.11.zip/download

我只需要修改一個類文件在裏面,生成jar文件,是否有任何教程/ apporach在eclipse上做?我試圖修改類文件,而不先使用eclipse(例如文本編輯器),然後在eclipse中選擇 ,選擇新項目=>使用文件夾作爲destiniation,然後我嘗試將它導出爲jar。它沒有錯誤,並且有一個jar文件出來,但我無法運行它。該jar文件無法正常工作。

因此,將一些兄弟只是好心幫我

  1. 下載zip文件

  2. 修改ClassConstants.java在proguard的\類文件 改變

    public static final String ATTR_StackMapTable      = "StackMapTable"; 
    

    public static final String ATTR_StackMapTable      = "dummy"; 
    
  3. 重新編譯,輸出一個jar文件

  4. 這是所有

感謝您的幫助。真的我已經試過了所有的一天,感謝您的幫助

更新

此外,當我更改了代碼並生成了罐子 它輸出

JAR creation failed. See details for additional information. 
    classfile [in proguard] is not on its project's build path 
    Unable to get package fragment root: proguard/classfile/ClassConstants.java 
    classfile [in proguard] is not on its project's build path 

這是爲什麼?由於

從項目自述文件

ProGuard, Java class file shrinker, optimizer, obfuscator, and preverifier 
========================================================================== 

This directory contains a number of alternative ways to build ProGuard: 

- build.sh  : a shell script for GNU/Linux 
- makefile  : a makefile for GNU/Linux 
- build.xml  : an Ant build file for all platforms 
- maven/pom.xml : a Maven POM for building the Maven artifacts 

- As a final alternative, you can also easily compile the code from the 
    command line: 

    mkdir classes 
    javac -sourcepath src -d classes src/proguard/ProGuard.java 
    javac -sourcepath src -d classes src/proguard/gui/ProGuardGUI.java 
    javac -sourcepath src -d classes src/proguard/retrace/ReTrace.java 

    For the ProGuard Ant task: 

    javac -sourcepath src -d classes -classpath lib/ant.jar \ 
     src/proguard/ant/ProGuardTask.java 

    For the ProGuard Gradle task: 

    javac -sourcepath src -d classes -classpath ..... \ 
     src/proguard/gradle/ProGuardTask.java 

    For the Java Micro Edition Wireless Tool Kit (JME WTK) obfuscator plug-in: 

    javac -sourcepath src -d classes -classpath wtklib/kenv.zip \ 
     src/proguard/wtk/ProGuardObfuscator.java 

Note that you'll have to install Ant and the JME WTK yourself. 

Enjoy! 

http://proguard.sourceforge.net/ 

Copyright (c) 2002-2013 Eric Lafortune ([email protected]) 

有沒有什麼辦法來構建它從一個瓶子?謝謝我使用Windows 7

回答

1

您應該將項目導出爲「Runnable JAR文件」。在嚮導的進一步步驟中,將要求您指定啓動配置(程序的入口點或帶有main方法的類)。

+0

謝謝,但我在啓動配置中什麼都看不到,因此我無法繼續? – user782104

+0

如果是這樣,那麼您必須通過在主要方法上右鍵單擊類並選擇「Run As ..」 - >「Java Application」來創建一個。之後,相應的啓動配置將出現在列表中。 – ka3ak

+0

錯誤,選擇不包含主要類型 – user782104

相關問題