import java.io.FileInputStream;
import java.io.IOException;
import java.io.File;
import java.util.Properties;
public class Example1
{
private static String dbUrl;
public Example1() throws IOException
{
Properties props = new Properties();
props.load(new FileInputStream(new File("./myfile.properties")));
dbUrl = props.getProperty("db.url");
System.out.println(dbUrl);
}
public static void main(String[] args) throws IOException
{
new Example1();
}
}
javac Example1.java
java -cp . Example1
Комментариев нет:
Отправить комментарий