Domanda

Hello all I am trying to run help file(.chm) from netbeans directory with the help of this code

Process proc=   Runtime.getRuntime().exec("hh.exe src/MOVECG_Pro.chm");

but problem arises when I try to run outside netbeans because inside jar src folder is not there. Kindly help me how to code it properly

È stato utile?

Soluzione

You have placed your chm file inside your source code directory. Clearly that directory is not there when you run the JAR. I guess you want to have a standalone JAR which contains the help file bundled within it.

Since exec delegates to the native platform to interpret the command string as something it can start a subprocess with, you can imagine that there will be trouble with transparently accessing a file buried inside the JAR archive.

So either provide the help file separately, or write code which will extract the help file from the JAR at runtime. Then pass its location to hh.exe.

Let me also make a general statement: since you are writing a Java program here, which is supposed to be platform-independent, your approach with a Windows-specific help file isn't exactly by the book.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top