1. The default current root directory of Eclipse is the directory where the project is located, that is, the first level of the SRC directory, the path is written from the SRC parent directory to find 2, This.getclass (). getClassLoader () default from the SRC directory to find files, That is, the root directory is SRC3, packaging jar after the default root is src, that is, the file from src start looking for 4, packaging jar get input stream can use This.getclass (). getClassLoader (). Getresouceasstream ("..")
5, in Eclipse often use refresh observation change 6, if the class to be packaged into a jar, then create a file in the class cannot use the full path, that is,String Path = This.getclass (). GetResource ("Data.txt"). GetPath ();File f = NewFile (path);You can't use a relative path, even if it's relative to the SRC directory.
Java Packaging jar and path issues