I have a requirement to parse some command line arguments in a Java application without using any third party libraries (like Apache CLI or JCommander). I can only use the standard Java 11 API.
They will be passed into my application on start up and with flags; e.g: java myClass -port 14008 -ip 140.086.12.12 which can be in any order.
I'm pretty new to Java, but how would I go about doing this. Can any standard API functions help with this? Or should I check them manually e.g: if arg[0] = "-port" then arg[0]+1 = port number.
Java myClass -port 14008 -ip 140.086.12.12. Output would be 2 variables with the port and ip address in them.