今天在看Spring的一些东西,刚开始看,编写了一个HelloWorld,中间除了不少错误,但是都排除了;但是,
最后的一个错误实在是摸不着头脑:
21:11:57,015 INFO [main] Main - javax.xml.transform.TransformerFactory=null
21:11:57,015 INFO [main] Main - java.endorsed.dirs=D:\Program Files\Java\jre6\lib\endorsed
21:11:57,031 INFO [main] Main - launchFile: E:\JavaWebAPP\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
21:11:58,453 FATAL [main] Main - No embedded stylesheet instruction for file: file:/E:/JavaWebAPP/myApp/config.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/E:/JavaWebAPP/myApp/config.xml
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/E:/JavaWebAPP/myApp/config.xml
at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)
... 2 more
原因:
我点击“运行”按钮的时候,是在config.xml配置文件下,而不是在main()所在的文件
原理:
Eclipse并不会在project中寻找工程的入口点,而是从你编辑器中的当前文件开始运行,所以报错了!