Tuesday, February 24, 2009

Jar'ing Files to Use With Eclipse

Assuming you have your PATH set properly on your machine, JAR'ing files is relatively easy. But I think I screwed something up at first. I first JAR'd .java files together using the command jar cvf journyxapi.jar *, which took everything in my jxapi_pkg directory and jar'd it up.

This of course did me no good whatsoever, since I need the actual class files in the jar for my application to work. So I made class files of everything in jxapi_pkg and re-ran the same command.

When I imported this JAR file into my eclipse project, I still was not able to import files in there. It was like the file didn't exist in eclipse.

So I finally bundled both my class files, and java files together in a directory, and then ran the command jar cvf journyxapi.jar jxapi_pkg.

This worked like a charm when I imported it into my project. I'm not sure if I'm just ignorant when it comes to jarring or what, but this is what I had to do to get my jar file behaving.

No comments:

Post a Comment