Wie unten gezeigt:
<Span style = "font size: 18px"> system.out.println ("++++++++++++++++++++++++++++++"); String path = system.getProperty ("java.class.Path"); String path2 = freemarkerWriter.class.getProtectionDomain (). GetCodesource (). GetLocation (). GetPath (); String path3 = freemarkerWriter.class.getProtectionDomain (). GetCodesource (). GetLocation (). GetFile (); String path4 = thread.currentThread (). GetContextClassloader (). GetResource (""). GetPath (); System.out.println ("Pfad 1 =" + Path); System.out.println ("Pfad 2 =" + Path2); System.out.println ("Pfad 3 =" + Path3); System.out.println ("Pfad 4 =" + Path4); System.out.println ("+++++++++++++++++++++++++++++++++"); </Span>Die obige einfache Methode (empfohlen), um einen Klassenpath -Klassenpfad in Java zu erhalten, ist der gesamte Inhalt, den ich mit Ihnen teile. Ich hoffe, Sie können Ihnen eine Referenz geben und ich hoffe, Sie können wulin.com mehr unterstützen.