public class ABC {
public ABC() {
File file = new File(\"xyz.xml\");
but when I run my jar as follows:
java -jar filena
The NullPointerException is a clear indication that the file was not found.
InputStream input=ABC.class.getResourceAsStream("/Element.xml");
Where is your XML file? If you place it in the same package (directory inside the jar file) as ABC.class, then it should be Element.xml without the leading slash.