Sub AppStart (Args() As String)
Log(asJO(Me).RunMethod("whereAmI",Array(Me)))
End Sub
Sub asJO(o As JavaObject)As JavaObject
Return o
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
#if java
import java.io.*;
import java.net.*;
public static String whereAmI(Class c) throws URISyntaxException, IOException{
return new File(c.getProtectionDomain().getCodeSource().getLocation().toURI()).getParent();
}
#End If
When run in ide (debug) returns (in my case) C:\b4j Problems\whereis app\Objects\bin
in release returns C:\b4j Problems\whereis app\Objects
Hi @Daestrum, your code works like a charm, thank you, @Erel, that path should be accessible by a File.DirSomething, as this directory is very usefull in [Non-UI] applications