Error: Could not find or load main class- Novice

后端 未结 4 900
春和景丽
春和景丽 2021-01-24 21:23

Hi I am a novice in JAVA. I have been getting this file not found exception inspite of the file existing in the very location I have specified in the path which is

Initi

相关标签:
4条回答
  • 2021-01-24 21:29
     "C:\Workspace\conf.txt"
    

    Those are escape sequences. You probably meant:

     "C:\\Workspace\\conf.txt"
    

    You also appear to call it config.txt in one snippet and conf.txt in the other?

    0 讨论(0)
  • 2021-01-24 21:34

    On this line:

    input = RandomAccessFile("C:\Workspace\conf.txt",'r');
    

    You need to escape the \'s

    input = RandomAccessFile("C:\\Workspace\\conf.txt",'r');
    
    0 讨论(0)
  • 2021-01-24 21:40

    You have to escape the backslash.

    input = RandomAccessFile("C:\\Workspace\\conf.txt",'r');
    

    and also

     input = new RandomAccessFile("C:\\Workspace\\conf.txt",'r');
    

    and why you have two different filename conf.txt and config.txt.

    0 讨论(0)
  • 2021-01-24 21:51

    Make sure the java process has permissions to read the file.

    0 讨论(0)
提交回复
热议问题