IntelliJ IDEA command line
-
I have this class:
public class Solution { public static List<Person> allPeople = new ArrayList<Person>(); static { allPeople.add(Person.createMale("Иванов Иван", new Date())); //сегодня родился id=0 allPeople.add(Person.createMale("Петров Петр", new Date())); //сегодня родился id=1 }
private static Person getPerson(String name, String sex, String bd) throws ParseException { Person person = null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH); if(sex.equals("м")) person = Person.createMale(name, simpleDateFormat.parse(bd)); else person = Person.createFemale(name, simpleDateFormat.parse(bd)); return person; } public static void main(String[] args) throws ParseException { //start here - начни тут if (args[0].equals("-c")) { Person person = getPerson(args[1], args[2], args[3]); allPeople.add(person); } else if (args[0].equals("-u")) { Person person = getPerson(args[2], args[3], args[4]); int id = Integer.valueOf(args[1]); allPeople.remove(id); allPeople.add(id, person); } else if (args[0].equals("-d")) { allPeople.remove(Integer.valueOf(args[1])); } else if (args[0].equals("-i")) { Person person = allPeople.get(Integer.valueOf(args[1])); System.out.println(person.getName() + " " + person.getSex() + " " + person.getBirthDay()); } }
}
My entrance program accepts arguments from the command line. How do you start a program with arguments in IntelliJ IDEA? Don't get me jar every time to check... ♪ ♪
-
Run/Debug - constituent Edit Configuration