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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cannot get Runtime.exec() to work

 
Bartender
Posts: 1971
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: 7585
176
  • 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: 1737
63
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: 27762
196
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.
 
    Bookmark Topic Watch Topic
  • New Topic