Abrir un archivo con PATH relativo al JAR
Hola, alguien sabe como puedo abrir un archivo que esta fuera del JAR pero con PATH relativo a este, por ejemplo intente esto con la clase Test dentro de un JAR y no me sive:
import java.io.*;
import java.util.Properties;
public class Test {
public static void main(String[] args) throws Exception {
// set up new properties object
// from file "myProperties.txt"
Class clase = new Test().getClass();
InputStream propFile = clase.getResourceAsStream("myProperties.txt");
Properties p = new Properties(System.getProperties());
p.load(propFile);
// set the system properties
System.setProperties(p);
// display new properties
System.getProperties().list(System.out);
}
}
import java.io.*;
import java.util.Properties;
public class Test {
public static void main(String[] args) throws Exception {
// set up new properties object
// from file "myProperties.txt"
Class clase = new Test().getClass();
InputStream propFile = clase.getResourceAsStream("myProperties.txt");
Properties p = new Properties(System.getProperties());
p.load(propFile);
// set the system properties
System.setProperties(p);
// display new properties
System.getProperties().list(System.out);
}
}
