?
Solved

uncommon issue with Runtime.getRuntime().exe   Not standard problem

Posted on 2006-05-10
5
Medium Priority
?
311 Views
Last Modified: 2010-03-04
Local XP pro PC with Tomcat 5.57  (This works on most any exe I try...is very forgiving)
I can launch and see exe's execute using Runtime.getRuntime().exe(cmdstring).  For example I can open          
 notepad.exe c:\\Apache\\Tomcat55\\webapps\\Test\\CommonXML\\yes.txt" as expected.  

Network XP pro server using remote log-in: (This is a dead end - never works)
notepad.exe c:\\Apache\\Tomcat55\\webapps\\Test\\CommonXML\\yes.txt"  

fails, no error codes.  

I've searched the web over, and have found numberious 'solutions', of which none have helped.
I know to try putting the parameters in an array, I have tried pasing the "cmd.exe /c notepad.exe....blah, blah....
I have used  escaped quotes.
The tomcat logs show nothing.
I changed Tomcats management config file catalina.policy file  
from
 permission java.lang.RuntimePermission "accessClassInPackage.org.apache.tomcat.util.digester";
to
 permission java.lang.RuntimePermission "*";

I have unstalled and reinstalled tomcat to paths with no spaces in the name.

  The only time I've been able to anything out of the network server is when I put a command line that has an exe the server cannot locate.
Then I get an error back the infamous 193, otherwise no matter what I throw at it, blinks and does nothing...doesn't lock up, just keeps on ticking.
Here is some sample code I've have used locally with success, and externally (network) with not success)


      try
        {  
            String cmd = " cmd.exe /c   notepad.exe ";
            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec(cmd);
            InputStream stderr = proc.getErrorStream();
            InputStreamReader isr = new InputStreamReader(stderr);
            BufferedReader br = new BufferedReader(isr);
            String line = null;rr
            System.out.println("<ERROR>");
            line = br.readLine();
            System.out.println(line);
            System.out.println("</ERROR>");
            int exitVal = proc.waitFor();
            System.out.println("Process exitValue: " + exitVal);
        } catch (Throwable t)
          {
            t.printStackTrace();
          }

  Any ideas?
0
Comment
Question by:flyboyut
  • 2
3 Comments
 
LVL 10

Expert Comment

by:sleep_furiously
ID: 16653726
If you want to launch "notepad", the service running Tomcat would probably need "Allow service to interact with desktop" permission.
0
 

Author Comment

by:flyboyut
ID: 16657730
My final goal is not to launch notepad, but a VB script.  This subsitution of notepad was an attempt to simplfy the problem for troubleshooting.
Another point : the vbscript I wish to start is on the server, and launches a test functionality from a product created by the calling application.  
0
 
LVL 10

Accepted Solution

by:
sleep_furiously earned 2000 total points
ID: 16661300
If you want to simplify testing, its probably better to call a substitute a console application instead of "Notepad" -- calling a GUI application complicates the situation because it will require special rights.  Maybe try running "tasklist" and see if it lists itself.

So if you are using a VB Script, be sure to use cscript and not wscript to run it.



0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question