简体   繁体   English

Linux java没有此类文件或目录,java.io.FileNotFoundException:

[英]Linux java No such file or directory, java.io.FileNotFoundException:

While using the File reader in the Linux system(RHEL) the below statements are not able to locate the file, same cod is working fine in Windows env. 在Linux系统(RHEL)中使用文件阅读器时,以下语句无法找到文件,相同的cod在Windows env中可以正常工作。

This code resists in one jar file which I cannot modify this is the snippet of the code 这段代码包含在一个我无法修改的jar文件中,这是该代码段

String fileInput = System.getProperty("filelocation");
BufferedReader inputReader = new BufferedReader(new FileReader(fileInput));

Attribute "filelocation" is passed as 属性"filelocation"方式传递

"/home/admin/Downloads/tools/bin/configuration.txt"

or 要么

"file:///home/admin/Downloads/tools/bin/configuration.txt"

Error log is 错误日志为

(No such file or directory)
java.io.FileNotFoundException: /home/admin/Downloads/tools/bin/configuration.txt 
 (No such file or directory) 
       at java.io.FileInputStream.open(Native Method) 
       at java.io.FileInputStream.<init>(FileInputStream.java:146) 
       at java.io.FileInputStream.<init>(FileInputStream.java:101) 
       at java.io.FileReader.<init>(FileReader.java:58) 
       at com.mycode.Config.readAppConfig(config.java:123)

It was not related to JAVA. 它与JAVA无关。 it was coming because of the shell script from where the variable was passed 它是由于传递变量的shell脚本而来的
used the statement input_file=${input_file:0:$(expr ${#input_file} - 1) } 使用语句input_file = $ {input_file:0:$(expr $ {#input_file}-1)}
this statement is used to remove the last character of a string, In my case it was a new Line char, which was not visible. 该语句用于删除字符串的最后一个字符,在我的情况下,这是一个新的Line char,它是不可见的。

thanks to the form : https://unix.stackexchange.com/questions/144298/delete-the-last-character-of-a-string-using-string-manipulation-in-shell-script/144345#144345?newreg=9e4833bcf644426aaf9f275bf4fd1743 感谢表单: https : //unix.stackexchange.com/questions/144298/delete-the-last-character-of-a-string-using-string-manipulation-in-shell-script/144345#144345?newreg = 9e4833bcf644426aaf9f275bf4fd1743

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.FileNotFoundException:..(无此类文件或目录) - java.io.FileNotFoundException: .. (No such file or directory) java.io.FileNotFoundException:没有这样的文件或目录错误 - java.io.FileNotFoundException: No such file or directory Error java.io.FileNotFoundException:[文件路径](没有这样的文件或目录) - java.io.FileNotFoundException: [filepath] (No such file or directory) java.io.FileNotFoundException(是一个目录) - java.io.FileNotFoundException (Is a directory) java.io.IOException:java.io.FileNotFoundException :(无此类文件或目录) - java.io.IOException: java.io.FileNotFoundException:(No such file or directory) Java FileWriter 类 - java.io.FileNotFoundException: * 没有这样的文件或目录 -Ubuntu - Java FileWriter class - java.io.FileNotFoundException: * no such file or directory -Ubuntu java.io.FileNotFoundException没有此类文件或目录错误,但目录存在 - java.io.FileNotFoundException No such file or directory error but directory exists java.io.FileNotFoundException(没有这样的文件或目录) - 下载文件 - java.io.FileNotFoundException (No such file or directory) - Download File java.io.FileNotFoundException:(无此类文件或目录)-使用servlet - java.io.FileNotFoundException: (No such file or directory) - Working with servlets 尝试访问.wav文件时java.io.FileNotFoundException(不是目录) - java.io.FileNotFoundException (Not a directory) when attempting to access a .wav file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM