getProperty('expense home rent'); } catch (Exception e) { System out println('Exception: ' + e); } finally { inputStream.. Is there a way to do this? Thanks in advance Saloon Keeperposted 4 years agoIf the jar doesn't represent your main executable, then I would just pass the relevant methods a Properties object directly. ' In the 2 nd article, we created and used a module as a directory structure For portability, a module may be exported to a JAR file and used.. Mar 08, 2010 Java ( jar) applications and games on 5530XM My problem with this setup is that some of the more recent Java applications are run as legacy as well; meaning ALL of the touch-aware apps and games that I have tried running. Here is my code: public String getPropValues() throws IOException { try { Properties props = new Properties(); String propertiesFileName = 'config.. printStackTrace(); } finally { if (input != null) { try { input close(); } catch (IOException e) { e.. You can make a separate source folder for your config files, and put it on the class path.. close(); } return propertyValue; } The problem is this does not pick up the external config file. Microsoft Word Mac Print Double Sided
Ranch Handposted 4 years agoHi, I am currently running a jar file and want it to pick up a config file in the same location where the jar lives (jar to use external config file).. If you don't want to do that, you should use a FileInputStream instead Ranch Handposted 4 years agoThanks for the reply.. Was actually easier than I thought Got there using the FileInputStream Here is the change: public String getPropValues() throws IOException { Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream('.. printStackTrace(); } } } // get the property value and return it return prop getProperty('expense.. properties'; inputStream = getClass() getClassLoader() getResourceAsStream(propertiesFileName); if (inputStream != null) { props.. home rent'); } Cheers! Marshalposted 4 years ago. /config/config properties'); // load the properties file prop load(input); } catch (IOException ex) { ex. 518b7cbc7d
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |