aspose file tools*
The moose likes Beginning Java and the fly likes Where should file path be? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Where should file path be?" Watch "Where should file path be?" New topic

Where should file path be?

Gulshan Singh
Ranch Hand

Joined: Apr 22, 2009
Posts: 41
I need to load a text file for my program. It only loads when its the absolute path, like C:\\file.txt. I want to make it so that it loads relative paths, so typing file.txt would load as long as its in the same directory as the program. I'm using Netbeans IDE and I tried putting file.txt by the classes and by the jar file, but it still can't locate the file when using a relative path. What should I do?
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36482
Take it off NetBeans and execute it from the command line.
I agree. Here's the link:
subject: Where should file path be?
Similar Threads
jar location question
Application path problem
Issue in including image in a html from another server
where should I place my txt file on Tomcat 3.2.2
java to read System environment variables!!!