10

Lets say I'm writing Java code in Eclipse and then save it as a runnable .jar file. The code is 100% self-written, so no imports from other sources.

Does anything in the .jar file (file headers, ..) hold private data about my PC or my Eclipse version?

Michael Easter
  • 23,733
  • 7
  • 76
  • 107
Tom
  • 503
  • 2
  • 13
  • 1
    Why not open it and see? You need not concern yourself about .class files. You'll find that the answer is "no", unless you hard wire absolute paths in your Class-Path. – duffymo Jul 26 '12 at 12:19
  • Check the manifest in your jar file. it's the only place that should contain such information if at all. – G-Man Jul 26 '12 at 12:21

3 Answers3

13

yep, potentially there is an auto-generate manifest file (jar:META-INF/MANIFEST.MF)

Here is default output of plugin

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

As you can see at least username added to the manifest file

UPDATE: if you are using maven, you may want to configure maven jar plugin

    <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>
Andrey Borisov
  • 3,160
  • 18
  • 18
0

I would be surprised if any of those things are set as metadata when creating a runnable jar.

Kurt Du Bois
  • 7,550
  • 4
  • 25
  • 33
0

Your runnable jar will only have the resources, the dependent libraries and the manifest.xml file in it.....

Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75