您的位置:首页 > 编程语言 > Java开发

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

2011-07-08 19:09 561 查看
原文:http://hi.baidu.com/ini_always/blog/item/3c4b7a531ca15e15377abe7e.html

前一阵子去实习,后来也没什么好写的,所以很久没写东西了。今天刚好遇到个错误,而且是可写的,所以拿来和大家一起分享。先看一下控制台输出的内容,如下:15:34:18,286 INFO [main] Main - javax.xml.transform.TransformerFactory=null
15:34:18,288 INFO [main] Main - java.endorsed.dirs=C:\SDKs\JDK\jre\lib\endorsed
15:34:18,293 INFO [main] Main - launchFile: E:\Eclipse Works\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
15:34:18,351 FATAL [main] Main - No embedded stylesheet instruction for file: file:/E:/Eclipse%20Works/filemanager2.x/config/conf.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/E:/Eclipse%20Works/filemanager2.x/config/conf.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:/Eclipse%20Works/filemanager2.x/config/conf.xml
at 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"。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐