In Java, how can I get the absolute path for a class file programatically?
One simple example will be: say I have test.class file, if I put it in C:\temp\, run it from anywhere, it will print out C:\temp. If I put it into C:\program files\test\, it prints out the above path, too.
In VC++ and VB, there is methods to do that, but I can not find a way to do in Java so far.
Maybe this concept is not cross-platform? so java don't have this at all?
Java experts please help. Thanks.
One simple example will be: say I have test.class file, if I put it in C:\temp\, run it from anywhere, it will print out C:\temp. If I put it into C:\program files\test\, it prints out the above path, too.
In VC++ and VB, there is methods to do that, but I can not find a way to do in Java so far.
Maybe this concept is not cross-platform? so java don't have this at all?
Java experts please help. Thanks.