Click here to Skip to main content
15,891,513 members
Home / Discussions / Java
   

Java

 
QuestionROLE BASED ACCESS CONTROL IN JAVA SOURCE CODE URGENTLY NEEDED Pin
raj-RBAC9-Jan-10 8:25
raj-RBAC9-Jan-10 8:25 
AnswerRe: ROLE BASED ACCESS CONTROL IN JAVA SOURCE CODE URGENTLY NEEDED Pin
Richard MacCutchan9-Jan-10 8:58
mveRichard MacCutchan9-Jan-10 8:58 
QuestionTake a screenshot of an inactive window Pin
xax9-Jan-10 2:03
xax9-Jan-10 2:03 
AnswerRe: Take a screenshot of an inactive window Pin
Rozis9-Jan-10 12:19
Rozis9-Jan-10 12:19 
QuestionHow to close MS Word(or any program are in progress) using java Pin
sharkbc8-Jan-10 20:58
sharkbc8-Jan-10 20:58 
AnswerRe: How to close MS Word(or any program are in progress) using java Pin
TorstenH.11-Jan-10 2:14
TorstenH.11-Jan-10 2:14 
AnswerRe: How to close MS Word(or any program are in progress) using java Pin
crystaljava22-Jan-10 0:03
crystaljava22-Jan-10 0:03 
AnswerRe: How to close MS Word(or any program are in progress) using java Pin
Arun Reginald Zaheeruddin28-Feb-10 23:52
Arun Reginald Zaheeruddin28-Feb-10 23:52 
As far as I know, you are only allowed to kill a process directly from within Java if it was started from the currently running Java code. However, if a certain process was not started from within your Java code, you would need to use a native third-party tool to do the job for you.

Thankfully, if you have Windows OS versions greater than Server 2003 or Vista, you can use the TASKKILL.EXE command-line application present in the ~\WINDIR\system32 folder to kill a certain task. Or perhaps, you can use the following code to do this explicitly from within your Java code:

Runtime runtime = Runtime.getRuntime();
String[] killArgs = {"TASKKILL", "/IM", "WINWORD.EXE"};
try
{
  Process processToKill = runtime.exec(killArgs);
  processToKill.waitFor();
  System.out.println(
    new StringBuffer()
      .append("Process exit code: ")
      .append(processToKill.exitValue())
      .toString());
  System.exit(0);
}
catch(java.io.IOException ex)
{
  ex.printStackTrace();
  System.exit(1);
}
catch(InterruptedException ex)
{
  ex.printStackTrace();
  System.exit(1);
}


Tell me if this works for you. I certainly hope this is what you were looking for.

The beginning of knowledge is the fear of God

QuestionConstruction of firewall decision diagram Pin
gayuit068-Jan-10 18:56
gayuit068-Jan-10 18:56 
AnswerRe: Construction of firewall decision diagram Pin
Richard MacCutchan8-Jan-10 22:23
mveRichard MacCutchan8-Jan-10 22:23 
GeneralRe: Construction of firewall decision diagram Pin
gayuit0621-Jan-10 18:53
gayuit0621-Jan-10 18:53 
GeneralRe: Construction of firewall decision diagram Pin
Richard MacCutchan21-Jan-10 22:02
mveRichard MacCutchan21-Jan-10 22:02 
GeneralRe: Construction of firewall decision diagram Pin
gayuit0628-Jan-10 21:30
gayuit0628-Jan-10 21:30 
GeneralRe: Construction of firewall decision diagram Pin
Richard MacCutchan28-Jan-10 22:19
mveRichard MacCutchan28-Jan-10 22:19 
AnswerRe: Construction of firewall decision diagram Pin
goWomenCS21-Mar-11 12:30
goWomenCS21-Mar-11 12:30 
QuestionEOF in BufferedReader Pin
002comp8-Jan-10 0:13
002comp8-Jan-10 0:13 
AnswerRe: EOF in BufferedReader Pin
David Skelly8-Jan-10 1:40
David Skelly8-Jan-10 1:40 
AnswerRe: EOF in BufferedReader Pin
Richard MacCutchan8-Jan-10 5:12
mveRichard MacCutchan8-Jan-10 5:12 
GeneralRe: EOF in BufferedReader Pin
002comp10-Jan-10 19:32
002comp10-Jan-10 19:32 
GeneralRe: EOF in BufferedReader Pin
Richard MacCutchan10-Jan-10 23:20
mveRichard MacCutchan10-Jan-10 23:20 
GeneralRe: EOF in BufferedReader Pin
002comp10-Jan-10 23:58
002comp10-Jan-10 23:58 
Question[Solved]Fatal Exception occured when running jar file [modified] Pin
Jordanwb7-Jan-10 3:17
Jordanwb7-Jan-10 3:17 
AnswerRe: Fatal Exception occured when running jar file Pin
Richard MacCutchan7-Jan-10 4:52
mveRichard MacCutchan7-Jan-10 4:52 
GeneralRe: Fatal Exception occured when running jar file Pin
Jordanwb7-Jan-10 7:16
Jordanwb7-Jan-10 7:16 
GeneralRe: Fatal Exception occured when running jar file Pin
Richard MacCutchan7-Jan-10 9:01
mveRichard MacCutchan7-Jan-10 9:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.