• Post Reply Bookmark Topic Watch Topic
  • New Topic

getCodeBase() rules  RSS feed

 
Nelson Nadal
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it necessary that the applet class and the file that it reads must be in the same directory like this...
URL textURL = new URL( getCodeBase() , "test.txt" );
Can't I do this?
URL textURL = new URL( getCodeBase() , "subdir/test.txt" );
Thanks.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can indeed do that, but only if "subdir" is a subdirectory of the directory the Applet's .class file was downloaded from; otherwise you may have to modify the URL's path a bit. You've also got getDocumentBase() to play with.
 
Nelson Nadal
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Sir Ernest.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!