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.
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.