R
rakeshgulati
Hi,
I am new to Java, just trying something with multithreading, but
thread is not getting started. Please advice
class Systhread implements Runnable {
int JobId;
Thread SysJob = new Thread();
Systhread( ) {
System.out.println ("Starting Job Id Constructor");
}
void subroute (int num) {
this.JobId = num;
System.out.println ("Assigning Job Id" + this.JobId);
SysJob.start();
}
public void run () {
System.out.println ("launching Job" + this.JobId);
try {
Runtime.getRuntime().exec("some command");
} catch (Exception e) {
System.out.println ("Exception launching Job" + this.JobId);
}
}
}
class caller {
public static void main (String args[]) {
Systhread Ob = new Systhread();
System.out.println ("Starting Job Id " + 1);
Ob.subroute(1);
}
}
output that I get is
I am not able to understand why SysJob.start();
is not able to start the thread and execute statments in run proc.
Thanks
Rakesh
I am new to Java, just trying something with multithreading, but
thread is not getting started. Please advice
class Systhread implements Runnable {
int JobId;
Thread SysJob = new Thread();
Systhread( ) {
System.out.println ("Starting Job Id Constructor");
}
void subroute (int num) {
this.JobId = num;
System.out.println ("Assigning Job Id" + this.JobId);
SysJob.start();
}
public void run () {
System.out.println ("launching Job" + this.JobId);
try {
Runtime.getRuntime().exec("some command");
} catch (Exception e) {
System.out.println ("Exception launching Job" + this.JobId);
}
}
}
class caller {
public static void main (String args[]) {
Systhread Ob = new Systhread();
System.out.println ("Starting Job Id " + 1);
Ob.subroute(1);
}
}
output that I get is
I am not able to understand why SysJob.start();
is not able to start the thread and execute statments in run proc.
Thanks
Rakesh