【问题标题】:Do runnable jars (via Eclipse) contain tracking information?可运行的 jars(通过 Eclipse)是否包含跟踪信息?
【发布时间】:2012-07-26 12:15:36
【问题描述】:

假设我在 Eclipse 中编写 Java 代码,然后将其保存为可运行的 .jar 文件。代码是 100% 自己编写的,因此没有从其他来源导入。

.jar 文件中的任何内容(文件头、..)是否包含有关我的 PC 或我的 Eclipse 版本的私人数据?

【问题讨论】:

  • 为什么不打开看看呢?您不必担心 .class 文件。您会发现答案是否定的,除非您在 Class-Path 中硬连线绝对路径。
  • 检查 jar 文件中的清单。如果有的话,它是唯一应该包含此类信息的地方。

标签: java eclipse anonymity


【解决方案1】:

是的,可能有一个自动生成的清单文件 (jar:META-INF/MANIFEST.MF)

这是插件的默认输出

Manifest-Version: 1.0
Built-By: borisov andrey
Build-Jdk: 1.7.0_05
Created-By: Apache Maven
Archiver-Version: Plexus Archiver

如您所见,至少在清单文件中添加了用户名

更新:如果您使用的是 maven,您可能需要配置 maven jar 插件

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>${maven-jar-plugin-version}</version>
      <inherited>true</inherited>
      <executions>
        <execution>
          <goals>
            <goal>test-jar</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <archive>
          <manifestEntries>
            <Created-By>${java.version} (${java.vendor})</Created-By>
            <Built-By>ME</Built-By>
            <Implementation-Title>${project.name}</Implementation-Title>
            <Implementation-URL>SOME URL if you want</Implementation-URL>
            <Implementation-Version>${project.version}</Implementation-Version>
            <Implementation-Vendor>your company</Implementation-Vendor>
            <Implementation-Vendor-Id>your vendore id</Implementation-Vendor-Id>
          </manifestEntries>
        </archive>
      </configuration>
    </plugin>

【讨论】:

  • built-by 的东西是由 Maven 添加的。它不是“标准的”,也不是 Java 本身所要求的。
  • 好点顺便说一句-谢谢。但仍然值得检查 META-INF/MANIFEST.MF
  • 非常感谢,如果默认只添加用户名,那么 Java 编程应该是隐私安全的。
【解决方案2】:

如果在创建可运行 jar 时将这些内容中的任何一个设置为元数据,我会感到惊讶。

【讨论】:

    【解决方案3】:

    您的可运行 jar 中将只有 resourcesdependent librariesmanifest.xml 文件.....

    【讨论】:

      猜你喜欢
      • 2016-04-12
      • 2015-01-23
      • 2017-06-24
      • 2020-02-10
      • 1970-01-01
      • 2015-01-26
      • 1970-01-01
      • 1970-01-01
      • 2014-09-10
      相关资源
      最近更新 更多