Re: Question about ant and running java programs
printdude1968@gmail.com wrote:
I'm trying to steer away from using an IDE so that I can learn more
about the internals of how Java works. I've started using Emacs and
Ant to write my code and compile it. What I am wondering is, based on
the build.xml file
found here http://johnandsharon.homelinux.com/repository/build.xml
...
$ pwd
/home/john/workspace/JavaWorkspace/HeadFirstJava/dist/lib
$ java -jar MyProject-20070415.jar
Failed to load Main-Class manifest attribute from
MyProject-20070415.jar
The jar command in that build file does not secify a manifest
file. The manifest file can indicate (among other things) the
main class. As I see it, there are two options.
1) Include a manifest file which specifies the main class,
at build time.
2) Indicate the main class at runtime.
Note: I would usually include a 'launch' task within the
build file itself, rather than building with ant, then launching
from the command line ( though I am no authority on ant -
'I do it my way' ;).
For most of these things, it is better to refer back to
the basic tool docs., ant tasks map closely to the
options as specified on the command line.
<http://java.sun.com/javase/6/docs/technotes/tools/index.html#basic>
HTH
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com