Ну вот я сделал с return:
static String/*void*/ showDir(int indent, File file) throws IOException {
//File file = new File(filename);
for (int i = 0; i < indent; i++)
System.out.print('-');
System.out.println(file.getName());
if(file.getName().startsWith("AM") && file.getName().endsWith("jnlp")){
System.out.println("Пойман засранец!"+file.getAbsolutePath());
// JNLPPath = file.getAbsolutePath();
return file.getAbsolutePath();
}
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++)
showDir(indent + 4, files[i]);
}
return "NOTHING";
}
Вызываю так:
System.out.println("!!!"+showDir(1, new File("F:\\Documents and Settings\\M\\Application Data\\Sun\\Java\\Deployment\\cache\\javaws\\http\\Dusers.xith.org\\")));
Вот результат:
-Dusers.xith.org
-----P80
---------DMJavaCoolDude
-------------DMJWS
-----------------DMlib
---------------------RMdisplaySettings.jar
---------------------RMjogl-win32-native.jar
---------------------RMjogl-win32.jar
---------------------RMvecmath.jar
---------------------RMxith3d.jar
---------------------RNjogl-win32-native.jar
-------------------------jogl.dll
---------------------RTdisplaySettings.jar
---------------------RTjogl-win32-native.jar
---------------------RTjogl-win32.jar
---------------------RTvecmath.jar
---------------------RTxith3d.jar
-----------------DMXith3D
---------------------DMframework
-------------------------898
-------------------------ALXith3DFrame.jnlp
-------------------------AMXith3DFrame.jnlp
Пойман засранец!F:\Documents and Settings\M\Application Data\Sun\Java\Deployment\cache\javaws\http\Dusers.xith.org\P80\DMJavaCoolDude\DMJWS\DMXith3D\DMframework\AMXith3DFrame.jnlp
-------------------------ATXith3DFrame.jnlp
-------------------------RMtinylogo.gif
-------------------------RMXith3DFrame.jar
-------------------------RMxith3dlogo.jpg
-------------------------RTtinylogo.gif
-------------------------RTXith3DFrame.jar
-------------------------RTxith3dlogo.jpg
!!!NOTHING
Мне надо наружу вытащить "F:\Documents and Settings\M\Application Data\Sun\Java\Deployment\cache\javaws\http\Dusers.xith.org\P80\DMJavaCoolDude\DMJWS\DMXith3D\DMframework\AMXith3DFrame.jnlp"