This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi All, I am taking a java web programming class and we have an assignment to write a servelet that when called will open a gui on the server to allow anyone sitting on the server to paste text into. The text pasted in the text field will then be formatted and returned to the original callers web browser.
What I'm wondering is, is it is possible to make a call to a servlet that will cause another application (which will be a gui) to open on the server macine?
Well the problem that it solves for the Prof is one in which he has 2 systems sitting on his desktop one a mac and the other a pc. If he wants to transfer some text from the mac to the pc very quickly and easily he starts the servlet it opens a GUI on the mac pastes the text and then returns. No need to ftp or copy file or rewrite text.
I also think this is an exercise in here's what I did lets see if you can do it too.
Straying from the merits of the exercise back to the topic, I looked at the runtime link you provided Ben and added some code to my doPost to open a test app that I have with a gui but I get returned an EXCEPTION_ACCESS_VIOLATION.
here's a code snippet inside my doPost method
I'm doing all of this on my local machine with admin privelges. Is there something else I need to add to execute an app as a specified user?
What kind of GUI your servlet going to invoke? Must it be another external application?
Perhaps you can just develop a simple Swing-based window that serves as the input screen at the server and running within the execution context of the servlet. What you need to do then is just pass the value back from the window to stream back to the client
SCJP, SCWCD, SCJWS, IBM 700,IBM 701, IBM 704, IBM 705, CA Clarity Technical<br /> <br /><a href="http://eddyleesinti.blogspot.com" target="_blank" rel="nofollow">http://eddyleesinti.blogspot.com</a>
Either way, it's a question of screen ownership. Under any real, multi-user system (which includes Mac OSX) there is a good likelyhood that the user under which Tomcat is running will not be the same user under which the GUI is running.
If, for the sake of the exercise, the teacher will insure that Tomcat is started user the same user that started the GUI, either approach, might work (I think). You would have to try it.
Which version of Mac will your teacher be running? Will you have access to that OS to build and test this app?
Joined: Mar 24, 2003
Thank you all for your assistance! I figured out the problem that I was having and Ben had it right on the money. When I looked more closely at the Tomcat service properties in windows the 'Allow service to interact with desktop' checkbox was unchecked. After I checked it I could do what I had been trying to do all along.