tags:

views:

47

answers:

1

Okay I understand this might be a simple question, but I was trying to figure out how to make a JAR file so that other people can run my program without having a software like jGrasp, eclipse, or netbeans. The problem I'm having is I save it as a JAR file and can execute it on my computer but when I email it to my friend, it says invalid or corrupt JAR file. Can anyone explain? Thanks

+1  A: 

Are you creating the file with the jar command? Does "jar tvf fn.jar" show you the contents? If so, the problem is probably with the email transfer. Keep in mind that a jar file is actually just a zip file with some special data in it, and some email servers will refuse to pass along zip files because of all the trojans that use emailed zip files.

One common problem would be if your email client isn't mime encoding it, so something along the way changes 0x0D (carriage returns) to 0x0D 0xOA (carriage return + line feed) or vice versa, which corrupts the hell out of binary files.

Paul Tomblin
No I do it through jGrasp it has a feature to do it, but I figured it out thanks.
John