Problema com JTree

Estou com problema no meu programa que contem um frame e um splitpanel.do lado esquerdo um jTree com duas opções.A segunda opção é um painel que contem um formulario para criação de um report com JasperReport.Qdo “rodo” o programa de dentro do Eclipse tudo fui normalmente,porém qdo gero o .jar ou tento rodar ele via prompt de comando ele retorna o seguinte erro: Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: net/sf/ja
sperreports/engine/JRDataSource
at Principal.valueChanged(Principal.java:80)
at javax.swing.JTree.fireValueChanged(Unknown Source)
at javax.swing.JTree$TreeSelectionRedirector.valueChanged(Unknown Source
)
at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(Unknown S
ource)
at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(Unknown S
ource)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(Unknown
Source)
at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(Unknown S
ource)
at javax.swing.JTree.setSelectionPath(Unknown Source)
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(Unknown Source)

    at javax.swing.plaf.basic.BasicTreeUI$Handler.handleSelection(Unknown So

urce)
at javax.swing.plaf.basic.BasicTreeUI$Handler.mousePressed(Unknown Sourc
e)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

abaixo minha classe :
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeSelectionModel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import java.awt.BorderLayout;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
/*

  • Created on 15/04/2005
  • TODO To change the template for this generated file go to
  • Window - Preferences - Java - Code Style - Code Templates
    */

/**

  • @author wrocha

  • TODO To change the template for this generated type comment go to

  • Window - Preferences - Java - Code Style - Code Templates
    */
    public class Principal extends JPanel implements TreeSelectionListener {

    /* (non-Javadoc)

    • @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
      /
      private JTree jTree;
      private JPanel painel;
      private Painel1 painel1;
      private Painel2 painel2;
      private JSplitPane split;
      /
      *

    /
    public Principal() {
    super(new BorderLayout());
    initialize();
    DefaultMutableTreeNode root = new DefaultMutableTreeNode(“root”);
    criaNos(root);
    jTree = new JTree(root);
    jTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    jTree.addTreeSelectionListener(this);
    JScrollPane scroll = new JScrollPane(jTree);
    painel = new JPanel();
    split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setDividerSize(1);
    split.setLeftComponent(scroll);
    split.setRightComponent(painel);
    add(split);
    // TODO Auto-generated constructor stub
    }
    /
    *

    • This method initializes this
    • @return void
      */
      private void initialize() {
      this.setBounds(0, 0, 500, 450);

    }
    public void valueChanged(TreeSelectionEvent e){
    String node = e.getPath().getLastPathComponent().toString();
    try{
    if(node==null)
    return;
    else{
    if(node.equals(“Registro”)){
    painel2 = new Painel2();
    split.setRightComponent(painel2);
    }
    if(node.equals(“Etiquetas”)){
    painel1 = new Painel1();
    split.setRightComponent(painel1);
    }
    }
    // TODO Auto-generated method stub
    }
    catch (Exception ex){
    ex.printStackTrace();
    }
    }
    public void criaNos(DefaultMutableTreeNode root){
    DefaultMutableTreeNode Registro = new DefaultMutableTreeNode(“Registro”);
    DefaultMutableTreeNode Etiquetas = new DefaultMutableTreeNode(“Etiquetas”);
    root.add(Registro);
    root.add(Etiquetas);
    }
    private static void createAndShowGUI(){
    JFrame jFrame = new JFrame();
    jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Principal p1 = new Principal();
    jFrame.setContentPane(p1);
    jFrame.pack();
    jFrame.setBounds(0,0,500,480);
    JMenuBar jMBar = new JMenuBar();
    JMenu menu = new JMenu(“Arquivo”);
    jMBar.add(menu);
    JMenuItem item1 = new JMenuItem(“Fechar”);
    item1.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    System.exit(1);
    }
    });
    menu.add(item1);
    jFrame.setJMenuBar(jMBar);
    jFrame.setVisible(true);
    }
    public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable(){
    public void run(){
    createAndShowGUI();
    }
    });
    }
    }

Se alguem puder me ajudar!!!
o erro aparece qdo seleciono o node “Etiquetas” , que é o painel que contem o jasper.
Abraços.

Este erro

java.lang.NoClassDefFoundError

indica que o seu programa tentou instanciar uma classe, mas ele não encontrou ela em lugar nenhum. Então, coloca o jar do jasper no classpath do seu projeto :wink: