I want to open help.chm file when click on the help button. At present , it is opened from the desktop when click help button. I copied and paste the file in one of the packages in my project. Is there a way to open this file from this package?
This is what I did to open the file from desktop
private void helpActionPerformed(java.awt.event.ActionEvent evt)
{
try
{
Runtime.getRuntime().exec("hh.exe C:/Users/toshiba/Desktop/help2.chm");
}
catch (Exception ex)
{
ex.printStackTrace();
System.out.println(ex.getMessage());
}
}
Use
getResourceAsStream(String name)orgetResources(String name)and provide the package name and resource name separated and prefixed by ‘/’.For example if the resource is in the package Test:
Inside the class which you want to access the resource from you’d do (
getResourceAsStream(String name)):or using
getResources(String name):for further help have a look at this great tutorial.