hi all,
i am trying to open a file with application using java. i faced many problems while processing it.

1. Using Runtime.getruntime.exec(); i faced the problem. i can open a file with application in the local system(server) where i have written the program. while by using the ip address i am accessing the program from local system(server). here the file with application open in that local system(system) only where the program code is.

2. using Response.setcontent(); here the file is downloading to the temporary folder and then opening but i need to open directly from the location.

3. using Javascript. here the program is running properly when outside the tomcat (webapps) folder but when i try to run using tomcat it throws an error " Activexobjects could not be supported".

see, i used three ways but i cant able to attain my expectation. so please help me for this problem.
i have to open a file with application directly from the specified location using java. pls help me by giving some solutions.
Advance thanks....

Recommended Answers

All 9 Replies

*sigh*

what is *sigh*

hey masijade do u know the solution for this.. reply pls

I know there isn't one, since what you want doesn't work the way you want it to, and you've been told that a million times.

k u tell how to do i will follow u. can u help pls.pls pls

commented: You have been told that you cannot do this many times already. -1

Then listen when he tells you that you CANNOT DO what you have been trying to do. You have been told this in many posts before in the many threads you have created on this same topic.

Get it through your head - You can't do this, so quit asking

ok i wont ask here after. i have one small doubt for what purpose this website daniweb.com is created.

if no one knows the solution for my problem means why u r replying me harshly. so mind ur own buisness if u have no idea for my problem. kkkkkkk...

Hy hidash_in
I didn't get the exact Idea what u wanna say.
But as I understand, I think u want to open a file using Java code.
I m trying to write a code, It works well on my PC, I hope it'll be useful for u.

public class OpenFileUsingJava
{
public static void main(String[]args)
{
 try
 {
  //Path for file that you want to open (it doesnt work well for Folder every tym)
  String a="c:\\a.txt";
  Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL \""+a+"\"");
 }
 catch(Exception exception)
 {
  exception.printStackTrace();
 }
}
}

No, that is not what he was asking - two years ago by the way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.