List of usage examples for java.lang System getenv
public static String getenv(String name)
From source file:com.microsoft.azure.management.appservice.samples.ManageWebAppSourceControl.java
/** * Main entry point.//ww w .j ava2s . c o m * @param args the parameters */ public static void main(String[] args) { try { //============================================================= // Authenticate final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION")); Azure azure = Azure.configure().withLogLevel(LogLevel.BASIC).authenticate(credFile) .withDefaultSubscription(); // Print selected subscription System.out.println("Selected subscription: " + azure.subscriptionId()); runSample(azure); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
From source file:com.microsoft.azure.management.network.samples.CreateSimpleInternetFacingLoadBalancer.java
/** * Main entry point./*w w w . j a va 2 s . co m*/ * @param args parameters */ public static void main(String[] args) { try { //============================================================= // Authenticate final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION")); Azure azure = Azure.configure().withLogLevel(LogLevel.BODY.withPrettyJson(true)).authenticate(credFile) .withDefaultSubscription(); // Print selected subscription System.out.println("Selected subscription: " + azure.subscriptionId()); runSample(azure); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
From source file:Main.java
static boolean isCi() { return "true".equals(System.getenv("CI")) || "true".equals(System.getenv("TRAVIS")) || "true".equals(System.getenv("CIRCLECI")); }
From source file:Main.java
public static String getExternalStorage() { String extSdCardStr = System.getenv("SECONDARY_STORAGE"); if (extSdCardStr != null) { File extSdCardFile = new File(extSdCardStr); if (extSdCardFile.isDirectory()) return extSdCardFile.getAbsolutePath(); }// w ww . j a v a 2 s .c o m return ""; }
From source file:Main.java
public static Boolean externalStorageExists() { String extSdCardStr = System.getenv("SECONDARY_STORAGE"); if (extSdCardStr != null) { File extSdCardFile = new File(extSdCardStr); return (extSdCardFile.isDirectory()); }// w w w .j a va2s .c om return false; }
From source file:Main.java
/** * @return a File path stored in the given environment variable, or null if none exists. *//*w w w . j ava 2 s . c om*/ private static File getFileFromEnvironmentVariable(String environmentVariable) { File file = null; try { String fileEnvPath = System.getenv(environmentVariable); if (fileEnvPath != null && !fileEnvPath.trim().equals("")) { file = new File(fileEnvPath); } } catch (SecurityException ignore) { } return file; }
From source file:Main.java
static File getDefaultGameDir() { String os = System.getProperty("os.name").toLowerCase(); String baseDir = null;//from w w w . ja va 2s . co m String subDir = ".minecraft"; if (os.contains("win")) { baseDir = System.getenv("APPDATA"); } else if (os.contains("mac")) { subDir = "Library/Application Support/minecraft"; } if (baseDir == null) { baseDir = System.getProperty("user.home"); } return new File(baseDir, subDir); }
From source file:de.tudarmstadt.ukp.uby.integration.alignment.xml.transform.sensealignments.VnFnSenseAlignmentXml.java
public static void main(String[] args) throws Exception { String UBY_HOME = System.getenv("UBY_HOME"); String alignmentFile = UBY_HOME + "SemLink/1.2.2c/vn-fn/VNC-FNF.s"; String outFile = UBY_HOME + "/target/verbNetFrameNetAlignment22c_newXml.xml"; DBConfig dbConfig = new DBConfig("localhost/uby_clarin_0_7_0w", "com.mysql.jdbc.Driver", "mysql", "root", "pass", false); VnFnSenseAlignmentXml al = new VnFnSenseAlignmentXml(alignmentFile, outFile, dbConfig); al.toAlignmentXml(al.getDefaultXmlMeta()); }
From source file:com.bstek.dorado.idesupport.StandaloneRuleSetExporter.java
public static void main(String[] args) throws Exception { String ruleSetFile = null;/*from w w w .j av a 2 s.c om*/ String doradoHome = null; if (args.length >= 2) { ruleSetFile = args[0]; doradoHome = args[1]; } else { throw new IllegalArgumentException(); } if (StringUtils.isEmpty(doradoHome)) { doradoHome = System.getenv("DORADO_HOME"); } StandaloneRuleSetExporter instance = new StandaloneRuleSetExporter(doradoHome); FileOutputStream fos = new FileOutputStream(ruleSetFile); PrintWriter writer = new PrintWriter(new OutputStreamWriter(fos, Constants.DEFAULT_CHARSET)); try { instance.exportRuleSet(writer); } finally { writer.flush(); writer.close(); fos.close(); } }
From source file:com.quangphuong.crawler.dbutil.DBHandler.java
public static Connection openConnection() { try {/*from w w w. jav a 2 s .c o m*/ Class.forName("com.mysql.jdbc.Driver"); boolean isDebug = System.getenv("OPENSHIFT_APP_NAME") == null; DBConfig dBConfig; if (isDebug) { dBConfig = new DBConfig(DBConstant.driver, DBConstant.host, DBConstant.port, DBConstant.schema, DBConstant.user, DBConstant.password); } else { dBConfig = new DBConfig(DBConstant.driver, DBConstant.OPENSHIFT_HOST, DBConstant.OPENSHIFT_PORT, DBConstant.schema, DBConstant.OPENSHIFT_USER, DBConstant.OPENSHIFT_PASSWORD); } System.out.println("COnnection str: " + dBConfig.toString()); Connection connection = DriverManager.getConnection(dBConfig.toString(), dBConfig.getUser(), dBConfig.getPassword()); return connection; } catch (Exception ex) { Logger.getLogger(DBConfig.class.getName()).log(Level.SEVERE, null, ex); } return null; }