Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package killsqldeveloper;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- /**
- *
- * @author lciesluk
- */
- public class KillSQLDeveloper {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- try {
- Process exec = Runtime.getRuntime().exec(new String[]{"ps", "-ef"});
- exec.waitFor();
- BufferedReader reader
- = new BufferedReader(new InputStreamReader(exec.getInputStream()));
- String line = "";
- while ((line = reader.readLine()) != null) {
- if (line.contains("sqldeveloper.conf")) {
- System.out.println(line);
- String[] split = line.split(" ");
- if (split.length > 2) {
- System.out.println(split[1]);
- if (!split[1].equals("")) {
- Process execKill = Runtime.getRuntime().exec(new String[]{"kill", "-9", split[1]});
- execKill.waitFor();
- } else {
- Process execKill = Runtime.getRuntime().exec(new String[]{"kill", "-9", split[2]});
- execKill.waitFor();
- }
- }
- break;
- }
- }
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement