Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/10/2014, 00:45
Avatar de Profesor_Falken
Profesor_Falken
 
Fecha de Ingreso: agosto-2014
Ubicación: Mountain View
Mensajes: 1.323
Antigüedad: 10 años, 7 meses
Puntos: 182
Respuesta: manejo del sistema windows desde java

Buenas,

Para Windows puedes obtener la lista de procesos:

Mediante el comando taskList.exe

Código Java:
Ver original
  1. try {
  2.         String line;
  3.         Process p = Runtime.getRuntime().exec
  4.         (System.getenv("windir") +"\\system32\\"+"tasklist.exe");
  5.         BufferedReader input =
  6.                 new BufferedReader(new InputStreamReader(p.getInputStream()));
  7.         while ((line = input.readLine()) != null) {
  8.             System.out.println(line); //<-- Parse data here.
  9.         }
  10.         input.close();
  11.     } catch (Exception err) {
  12.         err.printStackTrace();
  13.     }

O invocando la API Win32 mediante JNI o JNA:
Con JNA: https://github.com/twall/jna

Código Java:
Ver original
  1. WinNT winNT = (WinNT) Native.loadLibrary(WinNT.class, W32APIOptions.UNICODE_OPTIONS);
  2.  
  3.         WinNT.HANDLE snapshot = winNT.CreateToolhelp32Snapshot(Tlhelp32.TH32CS_SNAPPROCESS, new WinDef.DWORD(0));
  4.  
  5.         Tlhelp32.PROCESSENTRY32.ByReference processEntry = new Tlhelp32.PROCESSENTRY32.ByReference();
  6.  
  7.         while (winNT.Process32Next(snapshot, processEntry)) {
  8.             System.out.println(processEntry.th32ProcessID + "\t" + Native.toString(processEntry.szExeFile));
  9.         }
  10.  
  11.         winNT.CloseHandle(snapshot);


Respecto al historial del navegador, eso dependerá del navegador que quieras utilizar.
Por ejemplo, para Chrome, el historial está almacenado en una base de datos SQLite ubicada normalmente en: C:\Users\YourUserName\AppData\Local\Google\Chrome\ User Data\Default\History
Puedes acceder a ella de la forma habitual mediante JDBC

Dicho esto, no deja de parecerme absurdo utilizar un lenguaje multiplataforma como Java para hacer un desarrollo específico de Windows perdiendo así toda la portabilidad.
Para hacer este tipo de cosas hay lenguajes y plataformas de desarrollo mucho más adaptadas como .Net con C# o C++.


Un saludo
__________________
If to err is human, then programmers are the most human of us