• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Finding a file by setting the classpath  RSS feed

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to find a file by setting the classpath. The code I'm using is:
File currentDir = new File("prop.ini"));
and setting the classpath in the autoexec.bat file by adding the directory where the file resides:
set classpath=....(previous stuff);c:\temp;.
Unfortunately, it's not working. Can anyone enlighten me?
Thanks.
Yoo-Jin.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I'm understanding you correctly, you are trying to open/use a file in a Java program that resides in C:\Temp called prop.ini.
The classpath will not help you in this, it just tells the java utilities(such as java.exe and javac.exe) where to look for files, not you programs.
You may want to use the getCodeBase() method(not exactly sure what class it's in) and then add the rest of the path to the file.
 
What's brown and sticky? ... a stick. Or a tiny ad.
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!