0

I want to make an uninstaller for my software, I expected it to just delete the file and the registry, However, I get this instead, I Tried adding a space, Checking the syntax, And none of those worked, Here is some code, Error is way below the message.

    public static void main(String[] args) throws IOException {
        Runtime.getRuntime().exec("DEL " + query(WinReg.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{15100000-0000-0409924A46C310}", "InstallLocation") + "\\yes i already checked the name, also i dont feel like sharing the name.");
        Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{15100000-0000-0409924A46C310}");
    }

    private static String query(WinReg.HKEY Hub, String loc, String Value) throws IOException {
        return Advapi32Util.registryGetStringValue(Hub, loc, Value);
        }
    }
Exception in thread "main" java.io.IOException: Cannot run program "DEL": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at login2.s.main(s.java:10)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 5 more
  • `DEL` is not a program, but a shell command. This has an overview on how to do so. https://stackoverflow.com/questions/15464111/run-cmd-commands-through-java – Pawel Veselov Feb 15 '21 at 17:33
  • Thanks, @PawelVeselov, But I wish you would use answers for everyone to look at in case they have the same issue. – Display name Feb 15 '21 at 17:52

0 Answers0