code: public static final int write(final String key, 
          final String valueName, final String valueData) {
          
          final ProcessBuilder pb = 
              new ProcessBuilder("reg", "add", "\""+ key + "\"", "/v", 
                  valueName, "/d", valueData);
          try {
              final Process proc = pb.start();
              return proc.waitFor();
          } catch (IOException e) {
              LOG.error("Error writing to registry", e);
          } catch (InterruptedException e) {
              LOG.error("Error writing to registry", e);
          }
          return -1;
      }
docs: Reads the value of a registry key.
  
  @param key The registry key to query.
  @param valueName Name of the registry value.
  @return
  @return registry value or the empty string if not found.