Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在eclipse中修改src文件并重新编译、生成jar?_Java_Eclipse_Jar - Fatal编程技术网

Java 如何在eclipse中修改src文件并重新编译、生成jar?

Java 如何在eclipse中修改src文件并重新编译、生成jar?,java,eclipse,jar,Java,Eclipse,Jar,我正在修改一个现有的开源项目 它调用proguard,在项目中它有一个src文件夹 我只需要修改其中的一个类文件,并生成jar文件,在eclipse上是否有任何教程/方法可以这样做 我曾尝试在不使用eclipse的情况下修改类文件(例如文本编辑器), 然后在eclipse中,选择new project=>use the folder as destination,然后我尝试将其导出为jar。它没有错误,并且出现了一个jar文件,但我就是不能运行它。jar文件工作不正常 那么,请兄弟们帮我一下好

我正在修改一个现有的开源项目

它调用proguard,在项目中它有一个src文件夹

我只需要修改其中的一个类文件,并生成jar文件,在eclipse上是否有任何教程/方法可以这样做

我曾尝试在不使用eclipse的情况下修改类文件(例如文本编辑器), 然后在eclipse中,选择new project=>use the folder as destination,然后我尝试将其导出为jar。它没有错误,并且出现了一个jar文件,但我就是不能运行它。jar文件工作不正常

那么,请兄弟们帮我一下好吗

  • 下载zip文件

  • 修改proguard\classfile中的ClassConstants.java 改变

    public static final String ATTR_StackMapTable                        = "StackMapTable";
    

  • 重新编译,输出一个jar文件

  • 就这些
  • 谢谢你的帮助。真的,我已经试了一整天了,谢谢你的帮助

    更新

    另外,当我更改代码并生成jar时 it输出

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

    有没有办法从中构建一个jar?谢谢,我正在使用windows 7,您应该将项目导出为“可运行的JAR文件”。在向导的后续步骤中,您将被要求指定启动配置(程序的入口点或使用
    main
    方法的类)。

    谢谢,但我在启动配置中没有看到任何内容,因此无法继续?如果是,则您必须右键单击使用main方法的类并选择“运行方式…”->“Java应用程序”。之后,相应的启动配置将显示在列表中。
    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)