Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Cannot get Runtime.exec() to work

 
Bartender
Posts: 1829
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This is really odd.

In Tomcat, I have a REST app that works fine on the Mac. Yet, in windows (under Tomcat), trying to run a process as shown below returns null.



If I enter the parameters passed in the cmdArray at the command line on Windows, it works.

If I run the application, not using the Tomcat Manager (Tomcat started from the Service Manager, that is), but a local directory of Tomcat (separate from the Tomcat that runs from the service manager), the exec() also works.

--

Have worked on this for two days now and I have no idea how to fix this issue.

Should I install a new version of Tomcat Manager?
(the manager app that runs from Windows service manager)

The Runtime().exec() is simply failing to run.

I tried to connect to AWS over port 8000, but after having opened all the ports in AWS and in Windows, port 8000 is refused. (yet another challenge!)

Look forward to any suggestions.

Thanks....mike.
 
Saloon Keeper
Posts: 7073
165
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
It would help to see the command you're using. One possible gotcha is not to use absolute paths for everything - the executable as well as all files and/or directories that may be passed in as parameters.

You might consider using java.lang.ProcessBuilder instead of Runtime.exe.
 
Bartender
Posts: 1059
33
Eclipse IDE Postgres Database C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Are the working and non-working cases both using the identical authorization/running under the identical user?
Can there be some working permissions issue due to a subtle difference?
Was any helpful error message subtly written into the Windows Error Logs somewhere?
 
Saloon Keeper
Posts: 24207
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Note, this question has been asked again in the Tomcat forum with additional qualifications. See https://coderanch.com/t/745632/application-servers/doesn-Tomcat-Run-Python-Program#3463090

To avoid confusion, this thread has been locked.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic