run a exe file by java code
|
Go4Expert Member
|
|
| 6May2007,17:42 | #1 |
|
I have written a simple html editor in java. I have to open my html page in internet explorer when I click preview button in my application. to open my html page in internet explorer programmatically? any one can help me
|
|
Team Leader
|
![]() |
| 7May2007,10:10 | #2 |
|
If its a Windows system where the Java application runs, use this
Code: Java
|
|
Go4Expert Member
|
|
| 8May2007,09:49 | #3 |
|
can u explain little bit more? my html file path is "C:\myPage.htm". when I type this ide show a error illegal escape charectar.
|
|
Team Leader
|
![]() |
| 8May2007,10:06 | #4 |
|
Code: Java
You have to escape the slash in the path! |
|
Go4Expert Member
|
|
| 8May2007,13:53 | #5 |
|
Thank you very much for ur help. I like to use applications programatically. for an example I have to open a word file and draw a line programatically. Can I do this task by java or any programming language?
|
|
Team Leader
|
![]() |
| 8May2007,14:09 | #6 |
|
Go4Expert Member
|
|
| 11May2007,09:41 | #7 |
|
thanx
|
|
Newbie Member
|
|
| 5May2009,14:42 | #8 |
|
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + "C:\\sample.exe");
using this code I have open an exe file from java.... Now I want to open the same exe by passing two parameters....open a C source code and a file to redirect the output.... How can I do that? |
|
Banned
|
|
| 22Jun2009,15:22 | #9 |
|
In this coding to execute exe from java file.
Code:
import java.lang.*;
import java.io.*;
public class LoadNotpad{
public static void main(String args[])throws IOException{
Runtime r=Runtime.getRuntime();
Process p=null;
try
{
String s="c:\\windows\\notpad.exe";
p=r.exec(s);
}
catch(Exception e){
System.out.println("error==="+e.getMessage());
e.printStackTrace();
}
}
}
/*This is the exception when i am running the above code plz help me to execute
this code and the mentioned java file Win32Process is not in my jdk1.2.2 */
/*
java.io.IOException: CreateProcess: c:\windows\notpad.exe error=0
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Win32Process.java:64)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Runtime.java:272)
at java.lang.Runtime.exec(Runtime.java:195)
at java.lang.Runtime.exec(Runtime.java:152)
at LoadNotpad.main(LoadNotpad.java:11)
Tool completed with exit code 1
*/
|
|
Newbie Member
|
|
| 28Mar2011,16:27 | #10 |
|
Hello,
Just check your spelling mistake 'notpad.exe' change it notepad.exe bye |

