If you package the owl-file with the jar in which your project resides, you can try something like below.
Ronald
(this code is from the "MyModel" class, hence the reference to that in the 3rd line).
try {
// first try loading the model from the JAR
InputStream istream = MyModel.class.getResourceAsStream(fname);
// if this fails, try loading the model from a common file
try {
if (istream == null) {
System.out.println("Not loadable from JAR, trying regular file");
istream = new FileInputStream(fname);
} else {
System.out.println("Loading " + fname + " from JAR");
}
} catch(Exception e) {
// maybe the file name it is an URI
System.out.println("File not loadable, trying file name as URL.");
if(istream == null) {
istream = new URL(fname).openStream();
}
}
// if loading has failed, return
if (istream == null) {
System.out.println("Unable to load model: " + fname);
return null;
}
###############################################################
Ronald Cornet, PhD email:
[hidden email]
dept. of Medical Informatics phone: +31 (0)20 566 5188
Academic Medical Center, Room J1B-115 fax: +31 (0)20 691 9840
P.O.Box 22700 www:
http://kik.amc.uva.nl/home/rcornet/1100 DE Amsterdam
The Netherlands 'The truth is out there'
_______________________________________________
protege-owl mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-owlInstructions for unsubscribing:
http://protege.stanford.edu/doc/faq.html#01a.03