Revision: 4800 http://sourceforge.net/p/vexi/code/4800 Author: mkpg2 Date: 2015-06-28 18:46:12 +0000 (Sun, 28 Jun 2015) Log Message: ----------- Change. Configure with resource file inside jar, and not file on path.
Modified Paths: -------------- trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherMain.java Modified: trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherMain.java =================================================================== --- trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherMain.java 2015-06-23 09:38:58 UTC (rev 4799) +++ trunk/org.vexi-launcher/src/main/java/org/vexi/launcher/LauncherMain.java 2015-06-28 18:46:12 UTC (rev 4800) @@ -1,9 +1,9 @@ package org.vexi.launcher; -import java.io.File; import java.io.InputStreamReader; import java.net.ConnectException; import java.net.HttpURLConnection; +import java.net.URL; import java.net.URLConnection; import java.util.LinkedHashMap; import java.util.Map; @@ -35,11 +35,13 @@ } abstract public Launcher createLauncher(); + void init(String text){ init(text.split("\n")); } + void init(String[] args){ for(String s: args){ String[] k_v = s.split("="); String k = k_v[0]; - String v = k_v[1]; + String v = k_v[1].trim(); if("application_url".equals(k)){ this.applicationUrl = v; }else if("hash".equals(k)){ @@ -52,14 +54,14 @@ try{ launcher.initSplash(); - File confFile = new File("conf"); - if(confFile.isFile()){ - String[] conf = IOUtil.fileToString(confFile).split("/n"); - init(conf); - }else{ - log.warn("conf file does not exist"); + + + URL resource = getClass().getClassLoader().getResource("conf"); + if(resource!=null){ + String text = new String(IOUtil.inputStreamToBytes(resource.openStream()),"UTF8"); + init(text); } - + init(args); if(applicationUrl==null){ throw new Problem("'application_url' not specified (in conf or args)"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn