# The case of the supposedly encrypted jar

I ran into a weird situation involving a .jar file a bit ago that I'm posting here in the hopes that it will save someone else time in the future. I'm doing some Android work for a client, and I do most of my work on a Windows 7 box. The client sent me a .jar with a library I needed to use in the project; they added it to a .zip on a Mac and emailed it to me.

I opened the .zip, copied it to the workspace, and added it to the project. Everything appeared to build just fine. I started actually writing code against the library (I'm using Eclipse (Kepler)), and things started to get weird.

Basically, intellisense (or whatever it's called when Eclipse does it) could see the properties and methods in the library just fine. Everything looked fine in the editor. But if I did a clean and build, the build would fail; the error messages were all on the order of "method not found".

After doing the usual checks (verify that the file is in the right place; stop and start Eclipse), it occurred to me that this could be an "Internet blocked file" issue. Lo and behold - the file was marked as "Blocked". I hit the "Unblock" button and tried again - same results.

At this point I noticed that the filename was bright green in Explorer. After a little Googling, I found out this signified that the file was encrypted. Of course, it wasn't - not really. But somewhere along the line Windows 7 had gotten confused and thought that it was. So I went to the file properties on the .jar in my workspace, hit the "Advanced..." button next to "Attributes" and unchecked the "Encrypt contents to secure data" checkbox. This fixed the bright greenness of the file, but the project still wouldn't build.

At this point, half an hour in and stumped, I started trying random things (as you do). So I went to the original download folder (not the workspace), unblocked the file, unchecked the "encrypt" checkbox, and then copied the file to the workspace. Voila! The project built.

I still have no idea how the file got into that state, but at least now I have a possible solution if it happens again. Hopefully this will get Google indexed enough to help anyone else who runs into the problem.

Comment