Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • <!-- <?xml version="1.0" encoding="UTF-8"?> <project name="HW.makejar" default="makejar" basedir="."> <target name="makejar" description="Create a jar for the HW project"> <jar jarfile="HelloWorld.jar" includes="*.class" basedir="."/> </target> </project> --> This is the first XML file Commented Aug 1, 2010 at 16:54
  • <!-- <?xml version="1.0" encoding="UTF-8"?> <project name="HW.makejar" default="makejar" basedir="."> <target name="makejar" description="Create a jar for the HW project"> <jar jarfile="HelloWorld.jar" includes="*.class" basedir="."> <manifest> <attribute name="Main-Class" value="ami.HelloWorld" /> </manifest> </jar> </target> </project> --> This is the second XML file Commented Aug 1, 2010 at 16:55
  • All this xml in comments is not very readable, can you delete those comments and edit the question to include the xml you have so far? Commented Aug 1, 2010 at 19:00
  • Now the project file is: <?xml version="1.0" encoding="UTF-8"?> <project name="HW.makejar" default="makejar" basedir="."> <target name="makejar" description="Create a jar for the HW project"> <jar jarfile="HelloWorld.jar" includes="***.class" basedir="."> <manifest> <attribute name="Main-Class" value="HelloWorld" /> </manifest> </jar> </target> </project> But when I run it, I'm back to: c:\workspace\HW>java -jar HelloWorld.jar Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld In the jar: I see both the class file and the manifiest. I'll post below Commented Aug 1, 2010 at 23:11
  • Here is the manifest: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.1 Created-By: 16.3-b01 (Sun Microsystems Inc.) Main-Class: HelloWorld Commented Aug 1, 2010 at 23:11