My compiler is set to be compliant with java 1.8. When I run my code, it works and there are no warnings.
When I go to export everything as a runnable jar and execute it, it throws this error:
Exception in thread "main" java.lang.NoSuchMethodError: java.net.URLEncoder.encode(Ljava/lang/String;Ljava/nio/charset/Charset;)Ljava/lang/String;
at ...
My code needs to convert some user-input String to make an API-call, for which it needs to be URL compliant, e.g. by replacing spaces with ‘%20’. I am using java.net.URLEncoder.encode for this.
My system has jre version 1.8.0_411 installed so this really shouldn’t be happening, right?