001 /* 002 * $Id: Main.java,v 1.2 2003/03/28 17:50:45 gus Exp $ 003 * 004 * Developed for "Rethinking CS101", a project of Lynn Andrea Stein's AP Group. 005 * For more information, see <a href="http://www.ai.mit.edu/projects/cs101/">the 006 * CS101 homepage</a> or email <las@ai.mit.edu>. 007 * 008 * Copyright (C) 1998 Massachusetts Institute of Technology. 009 * Please do not redistribute without obtaining permission. 010 */ 011 012 package cs101.util; 013 014 /** 015 * Main hides the public static void main( String[] argv ) construct 016 * from students by providing a command line interface. Each command 017 * line argument is treated as a class name that is instantiated once. 018 * <br> 019 * Copyright 1998 Massachusetts Institute of Technology 020 * 021 * @see cs101.util.Coerce 022 * 023 * @author Todd C. Parnell, tparnell@ai.mit.edu 024 * @version $Id: Main.java,v 1.2 2003/03/28 17:50:45 gus Exp $ 025 * 026 */ 027 public final class Main { 028 029 public static void main(String[] argv) { 030 for (int i = 0; i < argv.length; ++i) { 031 try { 032 Object o = Coerce.newInstanceByClassname( argv[i] ); 033 } catch (CreationException ce) { 034 System.err.println("Could not create " + argv[i]); 035 System.err.println("Make sure you typed the class name correctly and that a no argument constructor exists."); 036 } 037 } 038 } 039 040 /** 041 * Prevent instantiation 042 */ 043 private Main() {} 044 } 045 046 /* 047 * $Log: Main.java,v $ 048 * Revision 1.2 2003/03/28 17:50:45 gus 049 * acomdate change in Coerce method name 050 * 051 * Revision 1.1.1.1 2002/06/05 21:56:32 root 052 * CS101 comes to Olin finally. 053 * 054 * Revision 1.4 1998/07/24 17:19:29 tparnell 055 * Placate new javadoc behavior 056 * 057 * Revision 1.3 1998/07/21 19:33:20 tparnell 058 * added private Main() 059 * 060 * Revision 1.2 1998/06/07 17:00:07 tparnell 061 * changed to use NewInstanceByClassname 062 * 063 * Revision 1.1 1998/06/04 23:18:14 tparnell 064 * added a StringToObject method in Coerce, and a generic Main wrapper so 065 * students can avoid public static void main(String[] argv) 066 * 067 */ 068 069