Launch a .CHM File From Inside the JAR
Is it possible to launch a .CHM file (help file) or any other file for that matter from inside a JAR file using Runtime.getRuntime().exe()? If it's not possible with that command is it possible at all? Thanks in advance.
[228 byte] By [
drawimagea] at [2007-11-27 11:50:34]

Here is the stacktrace:
java.io.IOException: Failed to open jar:file:/C:/Test/dist/test_file.jar!/com/test/help_file.chm. Error message: Access is denied.
at sun.awt.windows.WDesktopPeer.ShellExecute(Unknown Source)
at sun.awt.windows.WDesktopPeer.browse(Unknown Source)
at java.awt.Desktop.browse(Unknown Source)
at com.test.Test.jLabelHelpMouseClicked(Test.java:486)
at com.test.Test.access$300(Test.java:43)
at com.test.Test$4.mouseClicked(Test.java:181)
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.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(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)
The code I am using is the code that I previously posted with the "this" in front of getClass(). It fails at Desktop.getDesktop().browse(helpUrl.toURI()); Throwing an IOException. The program is GUI, I have no commands to run it, this particular code fires on a mouseClickEvent.
The Desktop.browse method says it produces:
[an] IOException - if the user default browser is not found, or it fails to be launched, or the default handler application failed to be launched
I assume whatever the "default handler application" is for .chm files, it can't open a help.chm that's within a jar. Items in a jar are not files, insofar as the os is concerned, and probably the program trying to open the help.chm is an os program.
Typically, resources (such as help files) that are required by the application's os-programs are extracted from jar files when the application is installed. (Note that I say os-program, not Java program - correctly configured, Java programs can operate with resources that are in jars.)
You could extract the help file at some later time, but why, instead of at installation?