aspose file tools*
The moose likes Java in General and the fly likes Process and Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Process and Thread" Watch "Process and Thread" New topic
Author

Process and Thread

sannuth kashikar
Greenhorn

Joined: Sep 16, 2008
Posts: 14
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

Joined: Jul 08, 2003
Posts: 24184
    
  34

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

Joined: Sep 16, 2008
Posts: 14
What is the use of java.lang.Process class.How useful is this ?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

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

Joined: Oct 27, 2005
Posts: 19696
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
 
subject: Process and Thread