Java Args Parse parseCommandLine(String[] args)

Here you can find the source of parseCommandLine(String[] args)

Description

parse Command Line

License

Apache License

Declaration

private static HashMap<String, String> parseCommandLine(String[] args) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.HashMap;

public class Main {
    private static HashMap<String, String> parseCommandLine(String[] args) {
        HashMap<String, String> configParameters = new HashMap<String, String>();

        for (int i = 0; i < args.length; i++) {
            String[] nameValue = args[i].split("=");
            if (nameValue.length != 2) {
                System.err.println("Command line parameter is not in the form key=value: " + args[i]);
                System.exit(-1);//from w ww .  j  ava  2 s. com
            }
            configParameters.put(nameValue[0], nameValue[1]);
        }

        return configParameters;
    }
}

Related

  1. parseArgs(String[] args)
  2. parseArgs(String[] args)
  3. parseArguments(final String[] args)
  4. parseArguments(String[] args)
  5. parseCLInput(String[] args)
  6. parseCommandLineArguments(String[] args)
  7. parseCommandLineArguments(String[] args)
  8. parseLines(String[] lines)
  9. parseProgramArguments(String[] args)