File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes applet - servlet communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "applet - servlet communication" Watch "applet - servlet communication" New topic

applet - servlet communication

Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
I have an applet and wanted to pass a string to the servlet and make the servlet execute a file in the server. Iam using Tomcat 4.1. The connectivity between the applet and servlet is proper. But the servlet doesnt execute the Exec() command. I have no idea why. Can you please look into it and help me out?

[ December 30, 2006: Message edited by: Bear Bibeault ]

[BSouther: Added UBB CODE tags]
[ December 30, 2006: Message edited by: Ben Souther ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

In future posts, please refrain from using all upper-case for your titles. I have updated this one for you.

[Asking smart questions] [About Bear] [Books by Bear]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Does it really not execute it? You mean in the sense that it is skipping it? That would be strange. Have you ascertained that the statements before and after are executed? Is there no stack trace? You might also want to read up on the pitfalls of using Runtime.exec.

[ UD: fixed URL ]
[ December 31, 2006: Message edited by: Ulf Dittmer ]
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Why of all things did you choose notepad.exe (a gui program with no input or output)?
How do you know it wasn't called.

If I were doing something like this, I would write a small batch script that writes something to a file, like...

Then call that batch script from your servlet and see if it wrote the file.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
Hi first iam sorry for the upper case subject in the post....

I wanted to see if it exec is working properly and ran notepad.... the problem is that when i run it notepad isnt executed....but when i give a waitFor() on this process, the statements after it are not executed ....

Shall try with the batch file as well in a few mins...
Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
It worked with the batch file running the exe but not when i directly run it... no idea why its wierd.... thanks a lot anyways..

I agree. Here's the link:
subject: applet - servlet communication
jQuery in Action, 3rd edition