Esben Skov Pedersen
Esben Skov Pedersen

Reputation: 4517

Build netbeans project from command line is a little different

I would like to build my project from the command line and make a hash of the output.

I used this script which seemed to work:

set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_09
set PATH=C:\Program Files\NetBeans 6.9.1\java\ant\bin;%PATH%
ant clean jar

It builds my project without errors, but the output is not binary equal. How can I call ant in exactly the same way as netbeans?

edit: I need the output to be equal because I want to compare md5 hash and compare to my version control. I'm using kdiff3 to compare and I have also extracted the jars and the different files seems to be related to a webservice client in my program.

Upvotes: 0

Views: 2159

Answers (1)

Jean Waghetti
Jean Waghetti

Reputation: 4727

Maybe it's because of the ant version stored in the manifest. NetBeans installs its own Ant, it can be different than the one installed in your system (acessible on your PATH). You should do the checksum only for the classes.

The jar created by NetBeans is like This

MyProgram.jar
 |
 |-> META-INF
 |     |
 |     |-> MANIFEST.MF
 |
 |-> package1
 |    |
 |    |-> classes of package1 and other packages
 |
 |-> package2
 |  ...
 |
 |-> package3
    ...

You should unzip your jar file and create the checksum based on the files under the folder that are your programs packages, i.e. package1, package2, package3 etc. MANIFEST.MF holds the version of ant and jdk used to create the application.

Upvotes: 1

Related Questions