get Absolute Path for a library file in java plugin -
i developing java plugin. in 1 case need pass address of jar file (located in library directory) third library. however, not know how obtain address of libraries located in plugin.
i used below code find plugin location (if have can add library folder end of , pass jar address):
string pluginlocation = getclass().getprotectiondomain().getcodesource().getlocation().getpath();
it returns below string:
/d:/eclipse/../workspace/javaproject/my.plugin/
however, address need "d:/workspace/javaproject/my.plugin/"
please let me know how can right path?
not familiar eclipse seeing use intellij myself maybe adding resource folder work. or maybe reading plugin different folder. if doesn't guess can try trimming string
Comments
Post a Comment