The Artima Developer Community
Sponsored Link

Java Answers Forum
how to open .chm?

4 replies on 1 page. Most recent reply: Feb 1, 2004 11:06 AM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
gabri

Posts: 9
Nickname: gabri
Registered: Jan, 2004

how to open .chm? Posted: Jan 15, 2004 12:14 PM
Reply to this message Reply
Advertisement
hello!
could you please help in this matter? i have a JButton whose action i wish to be to open a .chm.. how can i do that?
thank u


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: how to open .chm? Posted: Jan 19, 2004 5:27 AM
Reply to this message Reply
u can open any file using the classes of java.io packages.

Check filereader

Sachin Joshi

Posts: 12
Nickname: aspire
Registered: Jan, 2004

Re: how to open .chm? Posted: Jan 22, 2004 9:40 PM
Reply to this message Reply
hi,

try this option ...it worked for me

*************
import java.io.IOException;

public class OpenChmFile {
public static void main(String args[]) {
openChmFile();
}

public static void openChmFile() {
try {
Runtime r = Runtime.getRuntime();
r.exec("cmd.exe /c C:\\j2ee-tutorials\\j2ee-tutorials.chm");
} catch (IOException e) {
System.out.println("Exception is :"+e.getMessage());
e. printStackTrace();
}
}
}
************

May be even you can call openChmFile() method on Button Event.

Feel free to comment.

Sachin

gabri

Posts: 9
Nickname: gabri
Registered: Jan, 2004

Re: how to open .chm? Posted: Jan 31, 2004 3:27 PM
Reply to this message Reply
Hi,
Thank you for your reply...really didnt know how to solve problem. Now have experimented with things and came to a version where im using the proj path and a batch file removing the explicit path like this:

Runtime r=Runtime.getRuntime();
String help=CDocuManager.path;
help+="\\"+"\\showhelp.bat";
r.exec(help);

I'm not so experiment-ed, im experiment-ing.. thanx.
Gabri

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: how to open .chm? Posted: Feb 1, 2004 11:06 AM
Reply to this message Reply
I haven't tried what you have above, but I'm guessing that if you are doing from a GUI, then you will see a DOS box pop up every time you click that help button, which is a little cheesy. If you can live with that, fine.

If not, then you could write a little JNI class that calls WinExec() (or ShellExecute() or CreateProcess(), etc.) to run c:\windows\hh.exe (the app that is associated with the chm extension and which is automatically launched from the above stuff).

Flat View: This topic has 4 replies on 1 page
Topic: BufferedReader driving me nuts!! Previous Topic   Next Topic Topic: WebappClassLoader not unloaded after webapp reload (Tomcat 4.1.24)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use