Link to home
Start Free TrialLog in
Avatar of mgcIT
mgcITFlag for United States of America

asked on

RandomAccessFile get current path

can I create a RandomAccessFile and use the path that the current app (.class file) is running in?

for example :

RAF = new RandomAccessFile("Menu.txt", "r");


where Menu.txt is in the same folder as the class files that the app is currently running from.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mgcIT

ASKER

i don't see the difference... how would you start the application from a directory if there is no class files?
via the classpath, class files are found via the class loader
Avatar of Ajar
Ajar

Use following code to get hold of the location of the current class file
assuming MYClass is the class name


this.class.getResource("MYClass.class").toString()