MCPcopy Create free account
hub / github.com/BeichenDream/InjectJDBC / getJarFileByClass

Method getJarFileByClass

src/com/abc/Main.java:51–66  ·  view source on GitHub ↗
(Class cs)

Source from the content-addressed store, hash-verified

49 "\t\tjava -jar injectDatabase.jar inject 19716 c:/windows/temp/databaseconn.txt");
50 }
51 public static String getJarFileByClass(Class cs) {
52 String fileString=null;
53 String tmpString;
54 if (cs!=null) {
55 tmpString=cs.getProtectionDomain().getCodeSource().getLocation().getFile();
56 if (tmpString.endsWith(".jar")) {
57 try {
58 fileString= URLDecoder.decode(tmpString,"utf-8");
59 } catch (UnsupportedEncodingException e) {
60 fileString=URLDecoder.decode(tmpString);
61 }
62 }
63 }
64
65 return new File(fileString).toString();
66 }
67 public static String getMethodSignature(Method method) {
68 StringBuilder s = new StringBuilder();
69 Class[] types = new Class[method.getParameterTypes().length + 1];

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected