Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Process and Thread

 
sannuth kashikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

What is the difference between process and thread in java.How to have different processess in a java code.



Thank you.


 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sannuth kashikar wrote: How to have different processess in a java code.


A process is, more or less, the same as a program or application.

"A Java code with different processes" could only mean multiple copies of the JVM -- i.e., launching java.exe multiple times.
 
sannuth kashikar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the use of java.lang.Process class.How useful is this ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sannuth kashikar wrote:What is the use of java.lang.Process class.How useful is this ?


It's part of Java's machinery for launching other programs. It's useful to the extent that you ... need to launch other programs!

You don't create Process objects yourself. If you launch a program with the Runtime.exec() methods, or the ProcessBuilder class, then you will get a Process object that you can use to keep track of the running program.
 
Rob Spoor
Sheriff
Pie
Posts: 20669
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Process object is good for only a few things:
- interaction with the process using the input, output and error streams
- terminating the process
- waiting for the process to finish before doing anything else
- retrieving the exit code of the process

That's why there are only methods for these operations.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic