public void changeDictionary(String filePath) {
        updateDictFile(filePath);

        if (!configFileUpdated) {
            try {
                duplicateConfigFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        // Update the dict file info in the setting file
        SAXBuilder builder = new SAXBuilder();
        File xmlFile = new File("src/input/" + configFilePath);
        try {
            Document doc = (Document) builder.build(xmlFile);
            Element rootNode = doc.getRootElement();

            List<Element> elements = rootNode.getChildren("component");
            List<Element> childElements = null;
            for (Element e : elements) {
                if (e.getAttributeValue("name").equals("jsgfGrammar")) {
                    childElements = e.getChildren();
                    break;
                }
            }
            
            for (Element element : childElements) {
                if (element.getAttributeValue("name").equals("grammarLocation")) {
                    element.getAttribute("value").setValue(
                            "resource:/" + dictFilePath+"/");
                } else if (element.getAttributeValue("name").equals(
                        "grammarName")) {
                    element.getAttribute("value").setValue(dictFileName);
                }
            }

            XMLOutputter xmlOutput = new XMLOutputter();
            xmlOutput
                    .output(doc, new FileWriter("src/input/" + configFilePath));

            // Reload the setting file
            setVoiceManager();

        } catch (JDOMException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }