xie1113a
xie1113a
2009-07-17 14:52

Linux中的绝对路径 在java

  • 企业应用

File file = new File("/usr/local/apache2/htdocs/eworld01/tap.xml");
BufferedReader red = new FileReader(file);
为什么这路径读不到~~
[b]问题补充:[/b]
由于我对Linux中的路径很不熟悉
异常如下:
An error occurred at line: 21 in the jsp file: /createSitemap.jsp
The method readConfigSitemap() in the type CreateSitemap is not applicable for the arguments (String)
18: BufferedReader bf = null;
19: try {
20: //鐢熸垚sitemap.xml鏂囦欢
21: String path_name = createSitemap.readConfigSitemap(path_url);
22: //path_name = "/usr/local/apache2/htdocs/eworld01";
23: //璇诲嚭sitemap.xml鏂囦欢
24: File file = new File(path_url+"/tap.xml");

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
[b]问题补充:[/b]
多谢各位的回答~ 其实问题很简单~就是简单的I/O流的输出
这个错我也知道是路径出错了

只想问一下Linux中的路径是怎样子的,Linux是没有盘符的
/usr/local/apache2/htdocs/eworld01/tap.xml
这个路劲有错吗?我真的想不明白为什么会报着路劲错!

[b]问题补充:[/b]
:o
请问 pJun 兄台 了解过Linux中的路径没~~其实和XP本地路径是完全不同的~~
/usr/local/apache2/htdocs/eworld01/tap.xml这路径有错吗?用IO流读得到吗?

[b]问题补充:[/b]
再次谢谢各位的帮助~
其实问题早以解决了 只想了解的更多一点
我这问题是用全局变量解决的

[b]问题补充:[/b]
不好意思 贴出来的时候搞乱了~多谢 fengyunhust 兄台的指出 看得挺仔细的
好欣赏哦~我们在工作中无论做什么多要细心点,否则损的是自己

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

10条回答

为你推荐

换一换