Question

i want to open .chm help file when click on Help button on swing window. how should i do?

if(e.getActionCommand() == "Help" ){
        Runtime run = Runtime.getRuntime();
        try
        {
        Process child = Runtime.getRuntime().exec("F:\OfficeCommunicatorClient\src\resources\User Account HelpNew.chm\");
        }
        catch (Exception ex)
        {
        ex.printStackTrace();
        System.out.println(ex.getMessage());
        }

    }
Was it helpful?

Solution

try this from this site codeproject

 Runtime.getRuntime().exec("hh.exe F:/OfficeCommunicatorClient/src/resources/User Account HelpNew.chm");

check this also open chm file in java

OTHER TIPS

First of all remove last '\'. It suggests it is a directory instead of a file.

Secondly you should use either double '\' or single '/': F:\\OfficeCommunicatorClient\\src\\resources\\User Account HelpNew.chm or F:/OfficeCommunicatorClient/src/resources/User Account HelpNew.chm

@edit It seems that the help cannot be run itself. Use hh.exe to open the help file. Moreover the file must be inside "", so the string should look like: "hh.exe \"F:/OfficeCommunicatorClient/src/resources/User Account HelpNew.chm\""

To get the path you are relative to, use this sample code:

File f = new File(".");
System.out.println(f.getAbsolutePath());
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top