Current Position:Home > Class not found

Class not found

Update:10-11Source: network consolidation
Advertisement
OS - Ubuntu Gutsy 7.10
Kernel - 2.6.22-14-generic
NB - v5.5.1
Java version - java version "1.5.0" / gij (GNU libgcj) version 4.2.1 (Ubuntu 4.2.1-5ubuntu5)
Hi people, I've been working on this problem for a few hours now and htink I'm missing the obvious:
This is my source directory path:
/home/buster/NB_Projects/Team_CB_UML_080407_v3.2_Final_mb/CB_UML_Editor/src/teamcbuml/helpDocs/index.htm
I am trying to implement HTML help documentation to my UML editor in NetBeans:
My Help class source is as follows:
* Help - Provides user documentation
* Created on 06 March 2008, 00:22
package teamcbuml;
import java.io.*;
import java.net.URL;
import javax.swing.event.HyperlinkEvent;
* @author  M.Beattie
public class Help extends javax.swing.JFrame {
    private URL helpURL;
    /** Creates new form Help */
    public Help(URL hlpURL) {
        helpURL = hlpURL;
        try {
            HelpDisplayArea.setPage(helpURL);
        catch (Exception ex) {
            ex.printStackTrace();
        initComponents();
        this.setLocationRelativeTo(null);
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        HelpScrollPane = new javax.swing.JScrollPane();
        HelpDisplayArea = new javax.swing.JEditorPane();
        companyLogo = new javax.swing.JLabel();
        HelpContentsButton = new javax.swing.JButton();
        HelpCloseButton = new javax.swing.JButton();
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("UML Editor Help");
        HelpScrollPane.setBackground(new java.awt.Color(255, 255, 255));
        HelpScrollPane.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        HelpDisplayArea.setEditable(false);
        HelpDisplayArea.addHyperlinkListener(new javax.swing.event.HyperlinkListener() {
            public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {
                HelpDisplayAreaHyperlinkUpdate(evt);
        HelpScrollPane.setViewportView(HelpDisplayArea);
        companyLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/teamcbuml/images/logo.gif")));
        HelpContentsButton.setText("Contents");
        HelpContentsButton.setToolTipText("Return to contents page");
        HelpContentsButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                HelpContentsButtonMouseClicked(evt);
        HelpCloseButton.setText("Close");
        HelpCloseButton.setToolTipText("Close help documentation");
        HelpCloseButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                HelpCloseButtonMouseClicked(evt);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(HelpScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(companyLogo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 198, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(HelpCloseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(HelpContentsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(83, 83, 83))))
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(companyLogo))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(HelpContentsButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(HelpCloseButton)))
                .addGap(14, 14, 14)
                .addComponent(HelpScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 396, Short.MAX_VALUE)
                .addContainerGap())
        pack();
    }// </editor-fold>//GEN-END:initComponents
    private void HelpContentsButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HelpContentsButtonMouseClicked
        /** Select contents index */
        URL tempURL;
        tempURL = HelpDisplayArea.getPage();
        try{
            HelpDisplayArea.setPage(helpURL);
        catch (Exception ex) {
            ex.printStackTrace();
    }//GEN-LAST:event_HelpContentsButtonMouseClicked
    private void HelpDisplayAreaHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_HelpDisplayAreaHyperlinkUpdate
        /** Select page to display */
        if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try{
            HelpDisplayArea.setPage(evt.getURL());
        catch (Exception ex) {
            ex.printStackTrace();
    }//GEN-LAST:event_HelpDisplayAreaHyperlinkUpdate
    private void HelpCloseButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HelpCloseButtonMouseClicked
        /** Close Help Documentation */
        this.dispose();
    }//GEN-LAST:event_HelpCloseButtonMouseClicked
     * @param args the command line arguments
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                URL index = ClassLoader.getSystemResource("/helpDocs/index.htm");
                new Help(index).setVisible(true);        
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton HelpCloseButton;
    private javax.swing.JButton HelpContentsButton;
    private javax.swing.JEditorPane HelpDisplayArea;
    private javax.swing.JScrollPane HelpScrollPane;
    private javax.swing.JLabel companyLogo;
    // End of variables declaration//GEN-END:variables
}Everything compiles without error and the program runs, however when I click my button for the Help Interface, it displays everything except the index.htm info and throws a few errors. Mainly one error (NullPointerException) and I think the rest are subsequent errors. I figure it is something to do with the way I have defined the source path but am struggling to get anywhere with it. I have researched the net but finding something totally relevant to NetBeans I am struggling with.
Any advice is much appreciated.
Thanks

The Best Answer

Advertisement
Just to clarify, the following is the code that is flagged as erroneous:
/** Creates new form Help */
    public Help(URL hlpURL) {
        helpURL = hlpURL;
        try {
            HelpDisplayArea.setPage(helpURL);
        catch (Exception ex) {
            ex.printStackTrace();
        initComponents();
        this.setLocationRelativeTo(null);
        }The line complained about is:
HelpDisplayArea.setPage(helpURL);