eclipse中有两个项目!如何在其他项目中反射(reflect)一个类?我将其他项目的类路径放入系统的属性中。但仍然弹出类未找到异常。有什么好的解决办法吗?
System.out.println(System.getProperty("java.class.path"));
System.getProperties().put("java.class.path",
System.getProperty("java.class.path") +
";C:\\Users\\fu.jian\\workspace\\Study\\bin");
System.out.println(System.getProperty("java.class.path"));
Class<?> forName2 = Class.forName("study.Activator");
System.out.println(forName2);
最佳答案
右键单击项目以显示上下文菜单。
构建路径->配置构建路径
在Java 构建路径对话框下,选择项目选项卡并添加项目。
关于java - 如何反射(reflect)另一个项目的类信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10041382/