Dazza051197
asked on
Returning path to class file
I want to be able to read a text file from the same directory where my Jar file resides, or class files if I've not yet packaged them up.
How do I return the path to the class file or JAR file if the class I'm in is inside a JAR file ?
Thanks
Dazza
How do I return the path to the class file or JAR file if the class I'm in is inside a JAR file ?
Thanks
Dazza
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes Dazza
Use getResourceAsStream("FileN ame");
Shyam
Use getResourceAsStream("FileN
Shyam
ASKER
Thanks Igor
With a little bit of tweaking to the code you gave me, it now works. The code you gave me works fine for when the code is running from the Jar file, but if I'm still in Forte it returns null, so I managed to add some code to the else of the findExtRoot() to return the filepath if it's not running from the Jar file.
Thanks
Dazza
With a little bit of tweaking to the code you gave me, it now works. The code you gave me works fine for when the code is running from the Jar file, but if I'm still in Forte it returns null, so I managed to add some code to the else of the findExtRoot() to return the filepath if it's not running from the Jar file.
Thanks
Dazza
Jerson