Hello this is Lonnie Ribordy,
I have a program i am trying to write and part of it uses a 3rd party api called JDom, when i compile my program the it compiles perfectly fine.. but, when i try to run it i get the Exception in thread "main" java.lang.noClassDefFoundError org/jdom/input/SAXBuilder
my program is as below...
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;
import org.jdom.*;
import org.jdom.input.*;
import org.jdom.output.*;
public class COS extends JPanel implements ActionListener{
static JFrame f=new JFrame();
Image bgImage=null;
String message="";
public COS(){
try{
String xml="background.xml";
SAXBuilder builder=new SAXBuilder();
Document doc=builder.build(new File(xml));
Element root=null;
Element img=null;
String fimg=null;
try{
root=doc.getRootElement();
img=root.getChild("bgimage");
fimg=img.getText();
} catch(Exception e){
}
getFileImage(fimg);
} catch(Exception e){
message="File load failed: "+e.getMessage();
}
}
public void paintComponent(Graphics g){
if(bgImage!=null){
g.drawImage(bgImage,0,0,this);
}
else{
g.drawString(message,40,40);
}
}
public void getFileImage(String filein) throws IOException, InterruptedException{
FileInputStream in=new FileInputStream(filein);
byte[] b=new byte[in.available()];
in.read(b);
in.close();
bgImage=Toolkit.getDefaultToolkit().createImage(b);
MediaTracker mt=new MediaTracker(this);
mt.addImage(bgImage,0);
mt.waitForAll();
}
public void actionPerformed(ActionEvent e){
}
public static void main(String[] args){
COS newcos=new COS();
f.setSize(825,640);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().setLayout(null);
newcos.setBounds(5,5,800,600);
f.setLocation(10,5);
f.getContentPane().add(newcos);
f.setVisible(true);
}
}
could anybody tell what's wrong?