0
어떻게 IPath를 URL로 변환 할 수 있습니까? 필자의 경우 Java 프로젝트의 출력 위치를 URL로 변환하여 URLClassLoader
클래스를로드 할 수 있습니다. 내 코드는 다음과 같습니다Eclipse - IPath를 URL로 변환
javaProject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
URL url = new File(javaProject.getOutputLocation().toFile().getAbsolutePath()).toURI().toURL();
URL[] urls = new URL[] { url };
URLClassLoader classLoader = new URLClassLoader(urls);
Class<?> c = classLoader.loadClass(fully-qualified-class-name);
문제는 문자열 표현이 file:/C:/com.florianingerl.regexfindandreplace.matchevaluators/bin
이지만이 file:/C:/Users/Hermann/runtime-EclipseApplication/com.florianingerl.regexfindandreplace.matchevaluators/bin
URLClassLoader
이 클래스를 찾을 수 없습니다 같은해야 즉, URL은 상대 하나가 있다는 것이다 명백하게.
도움을 주시면 감사하겠습니다.