有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

JavaJAR符号信息:tdstrip的等价物是什么?

我有一本书。jar文件是1MB。如果没有调试信息,它应该是大约100KB。现在,如何剥离调试信息

borland世界的老前辈可能还记得一个名为tdstrip的工具,它可以从一个列表中删除符号信息。exe

Java世界中的等价物是什么?我正在做移动开发,1MB的文件太大了

我知道我可以重新编译和重建。jar文件没有调试信息,但是如果你没有源代码等等,你怎么做呢


共 (3) 个答案

  1. # 1 楼答案

    Proguard有收缩字节码的选项

  2. # 2 楼答案

    使用%JAVA_HOME%/bin/pack200 -r -G jartostrip.jar

    Usage:  pack200 [-opt... |  option=value]... x.pack[.gz] y.jar
    
    Packing Options
      -g,  no-gzip                   output a plain *.pack file with no zipping
       gzip                          (default) post-process the pack output with gzip
      -G,  strip-debug               remove debugging attributes while packing
      -O,  no-keep-file-order        do not transmit file ordering information
       keep-file-order               (default) preserve input file ordering
      -S{N},  segment-limit={N}      output segment limit (default N=1Mb)
      -E{N},  effort={N}             packing effort (default N=5)
      -H{h},  deflate-hint={h}       transmit deflate hint: true, false, or keep (default)
      -m{V},  modification-time={V}  transmit modtimes: latest or keep (default)
      -P{F},  pass-file={F}          transmit the given input element(s) uncompressed
      -U{a},  unknown-attribute={a}  unknown attribute action: error, strip, or pass (default)
      -C{N}={L},  class-attribute={N}={L}  (user-defined attribute)
      -F{N}={L},  field-attribute={N}={L}  (user-defined attribute)
      -M{N}={L},  method-attribute={N}={L} (user-defined attribute)
      -D{N}={L},  code-attribute={N}={L}   (user-defined attribute)
      -f{F},  config-file={F}        read file F for Pack200.Packer properties
      -v,  verbose                   increase program verbosity
      -q,  quiet                     set verbosity to lowest level
      -l{F},  log-file={F}           output to the given log file, or '-' for System.out
      -?, -h,  help                  print this message
      -V,  version                   print program version
      -J{X}                           pass option X to underlying Java VM
    
    Notes:
      The -P, -C, -F, -M, and -D options accumulate.
      Example attribute definition:  -C SourceFile=RUH .
      Config. file properties are defined by the Pack200 API.
      For meaning of -S, -E, -H-, -m, -U values, see Pack200 API.
      Layout definitions (like RUH) are defined by JSR 200.
    
    Repacking mode updates the JAR file with a pack/unpack cycle:
        pack200 [-r| repack] [-opt |  option=value]... [repackedy.jar] y.jar
    
  3. # 3 楼答案

    在移动世界中部署时,通过一些模糊处理工具运行整个jar文件是很常见的

    它的主要用途不是让反编译变得更困难,而是大大减小jar的大小

    模糊处理工具已经实现了许多减少jar大小的步骤:

    • 将所有存储的标识符缩短到尽可能小的程度
    • 剥离所有调试信息和非必要属性
    • 甚至可能重写字节码以节省空间