別のプラットフォームでアプリケーションを実行しようとしています。アプリケーションの使用は、入力および出力する場合があります。私はこのファイルを使用されるクラスと一緒に置きます。私が置いた道のために
public static String getPath() {
String decodedPath = null;
try {
String path = InstallApk.class.getProtectionDomain()
.getCodeSource().getLocation().getPath();
// URLDecoder decoder = new URLDecoder();
decodedPath = URLDecoder.decode(path, "UTF-8");
} catch (Exception e) {
e.printStackTrace();
}
return decodedPath;
}
しかし、たとえば、他のシステムまたはusbの他の位置でjarをテストしようとしているとき。書き込みパスはありませんが、間違っています。