954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

problem in opening a file with application using java

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....

hidash_in
Junior Poster in Training
86 posts since Oct 2007
Reputation Points: 1
Solved Threads: 0
 

*sigh*

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

what is *sigh*

hidash_in
Junior Poster in Training
86 posts since Oct 2007
Reputation Points: 1
Solved Threads: 0
 

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

hidash_in
Junior Poster in Training
86 posts since Oct 2007
Reputation Points: 1
Solved Threads: 0
 

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.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

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

hidash_in
Junior Poster in Training
86 posts since Oct 2007
Reputation Points: 1
Solved Threads: 0
 

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

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

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...

hidash_in
Junior Poster in Training
86 posts since Oct 2007
Reputation Points: 1
Solved Threads: 0
 

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();
 }
}
}
ankurgecr
Newbie Poster
5 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

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

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You