• Post Reply 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

Executing Shell command in the same process

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to run a shell command in the context of the current process in Java.
The way I know is using Runtime.getRuntime().exec() which will create a different process.
Actually I want to launching a browser in the same context of my java application.

Kindly tell me some work around for this.

Thank you in advance . . ..
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
None of the current variations of Unix or Windows allow multiple processes to share the same virtual address space. This is obviously done to protect the processes from each other. So... no. Java can't do that.

However, if you want to run two java programs, you can kinda simulate it by writing / running a wrapper that calls the main() method of the two classes.... but in that case, you have to be real careful that the two java programs don't step on each other. The OS don't know that they are two processes, and hence, doesn't provide any protection.

Henry
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic