I want to get File from project folder by using \"File class\" , How I can Do that ?
File file=new File(\"x1.txt\");
This sounds like the file is embedded within your application.
You should be using getClass().getResource("/path/to/your/resource.txt")
, which returns an URL
or getClass().getResourceAsStream("/path/to/your/resource.txt");
If it's not an embedded resource, then you need to know the relative path from your application's execution context to where your file exists