Eclipse报错"No embedded stylesheet instruction for file"的解决方法

来源:互联网 发布:无硅油洗发水品牌知乎 编辑:程序博客网 时间:2024/06/04 21:45

原文:http://hi.baidu.com/ini_always/blog/item/3c4b7a531ca15e15377abe7e.html


前一阵子去实习,后来也没什么好写的,所以很久没写东西了。今天刚好遇到个错误,而且是可写的,所以拿来和大家一起分享。

先看一下控制台输出的内容,如下:

15:34:18,286 INFO [main] Main - javax.xml.transform.TransformerFactory=null15:34:18,288 INFO [main] Main - java.endorsed.dirs=C:\SDKs\JDK\jre\lib\endorsed15:34:18,293 INFO [main] Main - launchFile: E:\Eclipse Works\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml15:34:18,351 FATAL [main] Main - No embedded stylesheet instruction for file: file:/E:/Eclipse%20Works/filemanager2.x/config/conf.xmlorg.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/E:/Eclipse%20Works/filemanager2.x/config/conf.xmlat 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:/Eclipse%20Works/filemanager2.x/config/conf.xmlat org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)... 2 more


以上错误是我在Eclipse中运行程序时,点击那个绿色的Run按钮时出现的,于是我Copy了关键词去Google,Google出来的东东边都沾不上。度娘更不行,看来,只有自己瞎掰了,说不定能掰出来呢。

我又尝试在Project上点右键,Run As->Java Application,结果居然能运行,我了个去,莫非是Eclipse的Bug?突然我灵光一闪,因为我点击Run按钮时,编辑界面显示的是一个xml文件,莫非?于是点击Run按钮右侧的下拉列表,选择main()方法所在的类运行,居然成功了!好了,真相大白了。

分析:因为编辑界面显示的是一个xml文件,所以点Run按钮时,Eclipse并不是去Project中寻找main()方法来运行,而是“运行”当前的xml文件,至于是在干什么我也不清楚,结果也很简单,因为你的xml不符合Eclipse的“运行”要求,所以它自然要报错了。

解决方法:运行Project时不要把编辑界面放在xml上,或者,手动选择main()方法所在的类,点"Run"。