Is it possible to get the current isntance name or path using Java code within the application? I need to know the path for some special logic but I don't want to hardcode the path for each environment. Appreciate any suggesions.
Do you mean the pwd or cwd of the class file which is actually running. may be try getting the results from System.getProperty(user.dir) . Look for other properties as well which might help you.
SystemClass PS: i haven't tried it yet. let us know if that works.
First of all, follow the suggestions given by Bear. Please carefully choose the forum before posting, if you want to get the results quickly. Our moderators/bartenders would move this thread to the appropriate forum for you.
Dilip kumar wrote: I need to know the path for some special logic but I don't want to hardcode the path for each environment. Appreciate any suggesions.
You can make use of a .properties file to accomplish the same. You have to make use of java.util.Properties class for reading the .properties file.