Ross Werner wrote:
If I'm trying to compile a whole bunch of java files, what's the best way
of doing it? I gave up trying to figure out an elegant way of doing it
(and the CS computers apparently don't have ant, which I think I might
have used sometime in the far distant past), and did this:

javac */*.java */*/*.java */*/*/*.java
jar cvf myjarfile.jar */*.class */*/*.class */*/*/*.class

'javac Main.java' will find it's dependencies and compile them for you, if you have them set up correctly.

Ant really is the solution if you know how to use it, but javac can mostly handle it. If the machine your using doesn't have Ant you can always download it.

I've also used NetBeans to manage my .jar files. You just create a new jar recipe in your workspace and it takes care of building it when you tell it to. You can even add manifest attributes to the recipe.

This seems really silly to me. It also doesn't work:

$ java -jar myjarfile.jar
Failed to load Main-Class manifest attribute from
myjarfile.jar

Easy: add a Main-Class attribute to the manifest. Have a look at the tutorial <http://java.sun.com/docs/books/tutorial/jar/index.html>, specifically <http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html>.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to