how to get full path name from realtive path
hi....
i have made a java program, which is called inside a shell script.
Now the filename is to be supppiled as a command line argument to shell like
Code :
./nsdnet.sh ./nsdnet_file.csv
what i want is , this command line name should be interpreted as full path by the java code
like /dialp/Release/bin
and if we write
as
Code :
./nsdnet.sh ../nsdnet_file.csv
, then the filename should get expand to /dialp/Release/nsdnet_file.csv
is this possible?
plz help
:confused:
Re: how to get full path name from realtive path
Write the Java code to browse everyfile on your pc until it finds it :) then you know the full path or you maybe able to make use of some of linux's search capabilities.
Chris
Re: how to get full path name from realtive path
You can use the getAbsolutePath() method in File.
Re: how to get full path name from realtive path
Doesn't that require you to gave the file object, not the file name...
Chris
Re: how to get full path name from realtive path
Create one then :P
Code :
File myFile = new File("file.txt");
myFile.getAbsolutePath();
Re: how to get full path name from realtive path
that would create it in the current directory, not what he is after
Re: how to get full path name from realtive path
Re: how to get full path name from realtive path
isn't that the point of relative paths? so you don't have to type out the whole current directory?
If you need a different directory (without knowing the complete address before-hand), this link is quite useful.
Re: how to get full path name from realtive path
thanx to all
but i have found the way in unix...