public void executeFromProperties(String propertiesFile) throws NullPointerException { this.propertiesFile = propertiesFile; PropertiesManager.register(propertiesFile); String sourcePath = PropertiesManager.getInstance().getPropertiesAsString("path.source"); if (!sourcePath.endsWith(File.separator)) sourcePath = sourcePath + File.separator; String targetPath = PropertiesManager.getInstance().getPropertiesAsString("path.target"); if (targetPath.endsWith(File.pathSeparator)) targetPath = targetPath + File.separator; String species = PropertiesManager.getInstance().getPropertiesAsString("species.path"); String language = PropertiesManager.getInstance().getPropertiesAsString("language"); s2k.execute(sourcePath, targetPath, species, language); }
public static void main(String[] args) { s2k = new General(); try { if (args.length > 0) { s2k.executeFromProperties(args[0]); } else { PropertiesGenerator propGen = new PropertiesGenerator("iabin.properties"); try { if (propGen.exists()) { s2k.executeFromProperties("iabin.properties"); } else { propGen.write(); System.out.println( "the file \"iabin.properties\" has been created on same folder as this program is"); } } catch (IOException e2) { e2.printStackTrace(); } } } catch (ArrayIndexOutOfBoundsException e1) { System.out.println( "__Please provide the path to the iabin.properties file or execute the script without arguments"); e1.getMessage(); } catch (NullPointerException e3) { e3.getMessage(); System.out.println( "some lines missing in " + args[0] + " file, add the line \"language=english\" to the " + args[0] + " file"); } }