import java.nio.file.Path;
import java.nio.file.Paths;
class MimeReader{
public static void main(String[] args){
if(args.length == 2){
Path keyPath = Paths.get(args[0]).toRealPath(true);
Path valuePath = Paths.get(args[1]).toRealPath(true);
}else{
System.out.println("Usage: MimeReader KEY VALUE");
}
}
}
And the following error is what the java compiler produces:Quote
MimeReader.java:7: error: method toRealPath in interface Path cannot be applied to given types;
Path keyPath = Paths.get(args[0]).toRealPath(true);
required: LinkOption[]
found: boolean
reason: argument type boolean does not conform to vararg element type LinkOption
Path keyPath = Paths.get(args[0]).toRealPath(true);
required: LinkOption[]
found: boolean
reason: argument type boolean does not conform to vararg element type LinkOption
It also reproduces the same error for line 8. What I'm understanding here is that somehow it's interpreting a boolean value when in fact its seeking out a LinkOption[] value. However, if I understand the javadocs, Paths.get() method returns a Path, and I can use the toRealPath method to return another Path. So what am I missing here?

New Topic/Question
Reply


MultiQuote







|