i would like to know the functionality of right click..meamning,.,,
if i select one icon and right clicked then i wants to open that ...
I want to perform this using java..if i run that program the output should be..the open file.
thanks
Printable View
i would like to know the functionality of right click..meamning,.,,
if i select one icon and right clicked then i wants to open that ...
I want to perform this using java..if i run that program the output should be..the open file.
thanks
my abc.doc is on my desktop i wants to open it..or rename it...(The Right Click Functionality)using java...
Ahhh...so confusing....
on my windows desktop i am having a file called abc.doc.In general i wants to open it through double click or right click open...if the same functionality i want it through my java code..got it..that means if i run my java program the abe.doc should open...
correct...
What i understand you want to open a word file using java code..If i am wrong then correct me.
Try this.
Code:
import java.io.*;
public class OpenWord
{
public static void main(String[] args){
try{
String fileName = "C:\\New.doc";
Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+fileName+"\"");
// OR YOU CAN USE
Runtime.getRuntime().exec("cmd /c \""+fileName+"\"");
}catch(IOException err){ // or use catch(Throwable err)
System.out.println("ERROR...."+err);
}
}
}
For adding an option when you right click on .DOC file, you will have to edit registry. there you will have to add a new key and the path to your program. Now on right click you will see the option to open the .DOC file in your code.
also, See above to implement the Opening of DOC file in JAVA
thanks i will try this