P
Piotre Ugrumov
I have downloaded this file: DomEcho1.java. I can compile this files,without
errors, with netbeans (I have imported the apis for this files in netbeans,
this file is an examples for XML-DOM). When I try to start this program,
this is the result:
C:\JAVA>java DomEcho1
Exception in thread "main" java.lang.NoClassDefFoundError: DomEcho1
How can I launch thsi example program?
Thanks.
//DomEcho1.java
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import java.io.File;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;
public class DomEcho01{
// Global value so it can be ref'd by the tree-adapter
static Document document;
public static void main(String argv[])
{
if (argv.length != 1) {
System.err.println("Usage: java DomEcho filename");
System.exit(1);
}
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
//factory.setValidating(true);
//factory.setNamespaceAware(true);
try {
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse( new File(argv[0]) );
} catch (SAXException sxe) {
// Error generated during parsing)
Exception x = sxe;
if (sxe.getException() != null)
x = sxe.getException();
x.printStackTrace();
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
}
} // main
}
errors, with netbeans (I have imported the apis for this files in netbeans,
this file is an examples for XML-DOM). When I try to start this program,
this is the result:
C:\JAVA>java DomEcho1
Exception in thread "main" java.lang.NoClassDefFoundError: DomEcho1
How can I launch thsi example program?
Thanks.
//DomEcho1.java
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import java.io.File;
import java.io.IOException;
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;
public class DomEcho01{
// Global value so it can be ref'd by the tree-adapter
static Document document;
public static void main(String argv[])
{
if (argv.length != 1) {
System.err.println("Usage: java DomEcho filename");
System.exit(1);
}
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
//factory.setValidating(true);
//factory.setNamespaceAware(true);
try {
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse( new File(argv[0]) );
} catch (SAXException sxe) {
// Error generated during parsing)
Exception x = sxe;
if (sxe.getException() != null)
x = sxe.getException();
x.printStackTrace();
} catch (ParserConfigurationException pce) {
// Parser with specified options can't be built
pce.printStackTrace();
} catch (IOException ioe) {
// I/O error
ioe.printStackTrace();
}
} // main
}