I am making a Java program and I want use parent directory’s parent directory, as I want to change the content of a file which is in that directory.
So far I tried :
static File pdir = new File(System.getProperty("user.dir")).getParentFile();
static File pdir2 = new File(System.getProperty("pdir")).getParentFile();
and some other things like that but none of them worked.
Error, on the second line, was:
Exception in thread "main" java.lang.ExceptionInInitializerError at Plugin.main.main(main.java:20) Caused by: java.lang.NullPointerException at java.base/java.io.File.(File.java:278) at Plugin.pfun.(pfun.java:13) ... 1 more
Can you recommend anything?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…