> I am trying to first check if the path contains jar file. If so, then I need to retrieve just
> the path without the jar file name.
On second reading this just doesn't make sense. How can you "check the path" unless you know the path. And if you know the path there's nothing to retrieve.
Perhaps "foo.jar" is a resource as located by, say. ClassLoader's getResource() method. In that case you take the returned URL and use toURI() to obtain a URI from which a File can be constructed and used as I described before.
What are you really trying to do?
Hey,
Is this what you want?
String str = new String("c:/foo/foo.jar");
int index = str.lastIndexOf('/');
System.err.println(str.substring(0, index));
Just take care of the path separator. you can use System Environment properties.
Cheers,
Satish Patil