java help file is not getting(.hs)

742 views Asked by At

I created one class (javahelp) in my project, for getting java help file as when I'm clicking a help content (menu item). I updated installed javahelp-2.0_05 in directory

C:\Program Files\javahelp-2.0_05\demos\bin\hsviewer.jar

Then Java exe file is contained in the directory

C:\Program Files\Java\jdk1.6.0_24\bin\java.exe 

My project is created in the directory

E:\java\databaserecord\src\HelpFile\javahelp

Then I updated java help file folder in the directory

E:\java\databaserecord\build\classes\javahelp-2.0_05\demos\hs\merge\Master.hs 

When I am clicking a HelpContent(menuItem), it should open a Master.hs file, but I am not getting any output and error. If I print that HelpSet URL, it's showing this line

file:/E:/java/databaserecord/build/classes/javahelp-2.0_05/demos/hs/merge/Master.hs

But it is not opening that helpset page. How to display the help set file?

import java.net.*;
import javax.swing.*;
import javax.help.*;
import java.awt.event.*;


public class javahelp1 extends javax.swing.JFrame {


    public javahelp1() {
        initComponents();
    }
    //HelpSet hs;

     public void helpset(){
      try {
          ClassLoader cl = javahelp1.class.getClassLoader();
        URL hsURL = HelpSet.findHelpSet(cl, "javahelp-2.0_05/demos/hs/merge/Master.hs");
       System.out.println(hsURL);
      HelpSet hs = new HelpSet(cl, hsURL);
      HelpBroker hb = hs.createHelpBroker();
      new CSH.DisplayHelpFromSource(hb);

      } catch(Exception ee) {
          System.out.println(ee);
        System.out.println("HelpSet: "+ee.getMessage());
      }

   }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jMenuBar1 = new javax.swing.JMenuBar();
        Mnu01 = new javax.swing.JMenu();
        Mnu02 = new javax.swing.JMenu();
        MnuItm01 = new javax.swing.JMenuItem();
        MnuItm02 = new javax.swing.JMenuItem();
        MnuItm03 = new javax.swing.JMenuItem();
        MnuItm04 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setFont(new java.awt.Font("Arial", 0, 10));

        Mnu01.setMnemonic('F');
        Mnu01.setText("File");
        Mnu01.setToolTipText("Create a File");
        jMenuBar1.add(Mnu01);

        Mnu02.setMnemonic('H');
        Mnu02.setText("Help");
        Mnu02.setToolTipText("For Help");

        MnuItm01.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        MnuItm01.setText("Content1");
        MnuItm01.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MnuItm01ActionPerformed(evt);
            }
        });
        Mnu02.add(MnuItm01);

        MnuItm02.setMnemonic('2');
        MnuItm02.setText("Content2");
        MnuItm02.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MnuItm02ActionPerformed(evt);
            }
        });
        Mnu02.add(MnuItm02);

        MnuItm03.setMnemonic('3');
        MnuItm03.setText("Content3");
        MnuItm03.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MnuItm03ActionPerformed(evt);
            }
        });
        Mnu02.add(MnuItm03);

        MnuItm04.setMnemonic('4');
        MnuItm04.setText("Content4");
        MnuItm04.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MnuItm04ActionPerformed(evt);
            }
        });
        Mnu02.add(MnuItm04);

        jMenuBar1.add(Mnu02);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 587, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 309, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>                        

    private void MnuItm02ActionPerformed(java.awt.event.ActionEvent evt) {                                         
           new javahelp2().setVisible(true);
}                                        

    private void MnuItm03ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        new javahelp3().setVisible(true);
    }                                        

    private void MnuItm04ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        new javahelp4().setVisible(true);
    }                                        

    private void MnuItm01ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            helpset();
    }                                        

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new javahelp1().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JMenu Mnu01;
    private javax.swing.JMenu Mnu02;
    private javax.swing.JMenuItem MnuItm01;
    private javax.swing.JMenuItem MnuItm02;
    private javax.swing.JMenuItem MnuItm03;
    private javax.swing.JMenuItem MnuItm04;
    private javax.swing.JMenuBar jMenuBar1;
    // End of variables declaration                   
}
1

There are 1 answers

0
Leo Smart On
public javahelp1(){

I am fairly new to java, but the only thing I was able to notice is that at the top, this is what you say. Is it possible that you forgot to say public void and that you were trying to declare a method? it could be something along those lines. I hope this was helpful :)