package jalview.bin; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import jalview.util.ChannelProperties; public class LaunchUtils { private static Properties userPreferences = null; public static String getUserPreference(String key) { if (userPreferences == null) { String channelPrefsFilename = ChannelProperties .getProperty("preferences.filename"); String propertiesFile = System.getProperty("user.home") + File.separatorChar + channelPrefsFilename; try { userPreferences = new Properties(); userPreferences.load(new FileInputStream(propertiesFile)); } catch (FileNotFoundException e) { // didn't find user preferences file return null; } catch (IOException e) { System.err.println(e.getMessage()); return null; } } return userPreferences.getProperty(key); } }