1
package propertiesreader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
 *
 * @author
 */
public class PropertiesReader 
{
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, IOException
    {
        // TODO code application logic here
        //Reading properties file in Java example
        Properties props = new Properties();
        FileInputStream fis = new FileInputStream("c:/jdbc.properties");

        //loading properites from properties file
        props.load(fis);

        //reading proeprty
        String username = props.getProperty("jdbc.username");
        String driver = props.getProperty("jdbc.driver");
        System.out.println("jdbc.username: " + username);
        System.out.println("jdbc.driver: " + driver);
    }

}

The system could not find the file specified in this line.

FileInputStream fis = new FileInputStream("c:/jdbc.properties");

What does this mean and how do I solve this?

seenukarthi
  • 8,241
  • 10
  • 47
  • 68
  • *"The system could not find the file specified in this line. What does this mean and how do I solve this?"* - Presumably it means that the file doesn't exist where you think it is. Generally speaking, for ease of portability, the file should be stored some where relative to the program or in an OS specific configuration location (`{user.home}\AppData\{You App}` on windows for example) or embedded within the application context, depending on if the file needs to be writable or not – MadProgrammer Apr 06 '15 at 09:10
  • 1
    either your file does not exist or you don't have permission to access. – Prashant Apr 06 '15 at 09:17

1 Answers1

0

Though I coded more in linux, I have seen people coding in windows generally use ":\\" in place of ":/". Check for file existence again and try ":\\" or ":\"
See : file path Windows format to java format Your case is just reverse

Community
  • 1
  • 1
user811602
  • 1,314
  • 2
  • 17
  • 47