• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open url from Servlet

 
yesukannan jeyaraj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have to open google.com from my servlet. The servlet will be called through PLSQL API so it will not will be called through browser.So i dont need javascript. Based on the operating system i openning the window. the code runs but the Google window is not oppened.

this my code

[ November 20, 2008: Message edited by: yesukannan jeyaraj ]

[BPSouther: Added code tags]

[ November 20, 2008: Message edited by: Ben Souther ]
[ November 20, 2008: Message edited by: yesukannan jeyaraj ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets are a server side technology.
If one were to open a window, it would be on the web server machine; not the client.
Is this what you want?
 
yesukannan jeyaraj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ben,
thanks for your speedy reply.No i want it to open in the client machine. is it possible.

regards
yesukannan
[ November 20, 2008: Message edited by: yesukannan jeyaraj ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Servlets have no ability to 'do' anything on the client machine.
All they can do is respond to requests over the HTTP protocol.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64962
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by yesukannan jeyaraj:
The servlet will be called through PLSQL API so it will not will be called through browser.
Sounds like you don't need it to be a servlet at all.
 
yesukannan jeyaraj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ben,
i am using linux OS when i run my code i get "java.io.IOException: cmd.exe: not found" error. Could you please correct me where i am moving wrong.

regards
yesukannan
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cmd.exe is a Windows executable.
You don't need it when calling out to the Linux shell.

In any case, as Bear mentioned, this doesn't sound like a servlet issue.
 
yesukannan jeyaraj
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Ben,
i am using linux OS. when i use this code in my class

String[] cmd = new String[] { "cmd.exe", "/C", "start", "http://www.google.com/search?q=Java+Tutorial" };
Runtime.getRuntime().exec(cmd);

instead of Runtime.getRuntime().exec(new String[] {browser, url});

i get "java.io.IOException: cmd.exe: not found" error. Could you please correct me where i am going wrong.

regards
yesukannan[/QB]
 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Ben, Bear and probably others have said, you have a problem, but its not a servlet related question. You are posting in the wrong section of the Ranch.

Your specific problem appears to be that you don't realize that Linux does not have a "cmd.exe" and that is not how one does what you want in a Linux world.
 
Srikanth Nutigattu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To clear this a bit, let me highlight you few points.

1. Servlets are Serverside technologies.. You CANNOT execute anything on the client using servlets.

2. If you want to open a browser on client or what ever, you need client side applications using J2SE.

3. There is NO cmd.exe in LINUX.

Please read the above posts of Ben and Bear. I think you need to seriously rethink your strategy.
[ November 21, 2008: Message edited by: Srikanth Nutigattu ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic