通过查询注册表捕获Java主路径

时间:2017-08-28 23:12:14

标签: batch-file

感谢您查看我的查询。

我有一个批处理脚本来安装java,我使用以下命令来捕获JAVA_HOME和JRE_HOME路径。但是,我在reg查询中看到一个错误。能帮帮我吗。

我正在使用的命令:

public static void main(String [] args) throws IOException, ParseException {
    FormatReader archivoOriginal = new FormatReader("file.xls");
    Sheet hoja;
    hoja = archivoOriginal.getSheet(0);

    int rowStart = 0;
    int rowEnd = hoja.getLastRowNum();        

    //Read File
    for (int rowNum = rowStart; rowNum <= rowEnd; rowNum++) {
        Row r = hoja.getRow(rowNum);
        int lstCell = r.getLastCellNum();
        for (int i = 0; i < lstCell; i++) {
            Cell c = r.getCell(i);
            if (c == null) {
                continue;
            }
            String campoValor = "";
            //CopyStyle of the cell
            c.setCellStyle(c.getCellStyle());
            switch (c.getCellType()) {
                case Cell.CELL_TYPE_STRING:
                    campoValor = c.getStringCellValue();
                    c.setCellValue(Funciones.replaceChars(campoValor));
                break;
                case Cell.CELL_TYPE_NUMERIC:
                    if (DateUtil.isCellDateFormatted(c)) {
                        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                        Date date = c.getDateCellValue();
                        campoValor = df.format(date);
                        c.setCellValue(date);
                    } else {
                        double d = c.getNumericCellValue();
                        campoValor = Double.toString(d);
                        c.setCellValue(d);
                    }

                break;
            }
        }
    }
    //End reading

    //Override File

    FileOutputStream fileOut = new FileOutputStream("file.xls");
    archivoOriginal.getArchivo().write(fileOut);
    fileOut.close();

    //Close File reader
    archivoOriginal.close();

}

错误: 错误:系统无法找到指定的注册表项或值。

感谢。

0 个答案:

没有答案