On 10/30/2014 4:22 AM, Kapil Shukla wrote:
HI All - sorry is this is a naive question but i am trying to do the lab-1010 with intellij community edition. and the problem i am facing is that when i create myProperties.txt file i place it in my source (src) folder and when i provide relative path i get an null pointer exception as the file is not found.

More than a java its the IDE related problem on how to configure IDE so that it can identify my resources and pick them up,

The code below in the sample app assumes the file is in
the root of the project

try {
propFile = new FileInputStream(
"myProperties.txt");
            p = new Properties(System.getProperties());
p.load(propFile);
        } catch (IOException e) {
System.out.println(e);
        }


You can change the code to specify the full path
as shown below

try {
propFile = new FileInputStream(
"/mypath/myProperties.txt");
            p = new Properties(System.getProperties());
p.load(propFile);
        } catch (IOException e) {
System.out.println(e);
        }


Any help is much appreciated.
--
You received this message because you are subscribed to the Google Groups "JPassion.com: Java Programming" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.


--
-------------------------------------------------------------------
             Sang Shin, [email protected]
  Founder and Chief Instructor of JPassion.com (JavaPassion.com)
         http://www.linkedin.com/in/javapassion (Linkedin)
          http://twitter.com/javapassion (Tweeter)
            Life is worth living... with Passion!
Practically Free 3 to 5 days Live, Hands-on, Online Codecamps on
 Java,Spring,Hadoop,HTML5,Ruby/Rails,Grails,JavaScript/jQuery,Android
             http://jpassion.com/codecamps
----------------------------------------------------------------------

--
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java.
For more options, visit https://groups.google.com/d/optout.

Reply via email to