Pregunta

I am working on modify an exist open source project

it it call proguard, in the project it has a src folder

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

I only need to modify one Class file in it , and generate the jar file, is there any tutorial /apporach to do it on eclipse?

I have tried to modify the class file without using eclipse first (e.g a text editor), then in eclipse , select new project=> use the folder as destiniation, then I try to export it as jar. it has no error and a jar file is come out , but I just can not run it. the jar file is not working properly.

So , would some brothers just kindly help me

  1. download the zip file

  2. Modify the ClassConstants.java at proguard\classfile change the

    public static final String ATTR_StackMapTable                        = "StackMapTable";
    

    to

    public static final String ATTR_StackMapTable                        = "dummy";
    
  3. recompile, output a jar file

  4. That's all

Thanks for helping .really I have tried that for all day, thanks for help

Update

Also , when I change the code and gen the jar it output

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

why is that? Thanks

From the project readme file

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 (eric@graphics.cornell.edu)

is there any way to build a jar from it? Thanks I am using windows 7

¿Fue útil?

Solución

You should export the project as "Runnable JAR file". In the further steps in the wizard you will be asked to specify the launch configuration (the program's entry point or the class with the main method).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top