OLá …estou tentando fazer um teste pra substituir sql por aqruivo
properties…
mas está me dando erro …
o que pode ser não está achando o aqruivo mas está junto com o .java
se alguém puder me ajudar …
abs
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
public class SemSql {
/**
* @param args
*/
private static final String USUARIO = "usuario.selectByName";
public static void main(String[] args) throws FileNotFoundException, IOException {
// TODO Auto-generated method stub
Properties queries = new Properties();
queries.load(new FileInputStream("arquivo.txt"));
String nome =queries.getProperty(USUARIO);
System.out.println("nome="+nome);
}
}
erro :
Exception in thread “main” java.io.FileNotFoundException: arquivo.txt (O sistema não pode encontrar o arquivo especificado)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at src.SemSql.main(SemSql.java:23)
arquivo.txt
usuario.selectByName=select * from usuario where name = ?
usuario.selectByEmail=select * from usuario where email = ?