Jiaxing Yiwei Zejun Rui Runxia Ryan Matthew 
Serena Jashan Andrew Kevin Jingyun Bakr Yawen 

Find these in the book:

 1 Write simplest shortest program that reports mouse motion.

How about pp. 502-505...

 2 Write simplest program that reports mouse events other than motion.

How about p. A-14 (Appendix D) ... 

 3 Write simplest program that can keep and report time.

How about pp. 499-502 ... 

 4 Write the simplest shortest program that sorts objects using Comparable.

How about pp. 477-479 ... 

 5 Write the simplest shortest program that sorts objects via the Comparator interface.

How about p. 667 ... 

 6 Write simplest program that shows why and how we use Exceptions. 

How about pp. 542-543, 540, 546-548 ... 

 7 Write simplest/shortest program that processes and responds to keyboard events. 

How about pp. 506, 491 

 8 Write simplest program that creates/shows on the screen a few circles of various colors.

How about Labs 03, 04 and endings of chapters 02, 03 now ...
 
 9 Write simplest program with a JButton, JTextField and JLabel.

How about pp. 496-498, Homework 09, Chapter 20, posted help with Homework 09 ... 

Also: 

 http://silo.cs.indiana.edu:8346/c212/sum2018/0712b.html

This week:

  Semester Project 

  Exam 03

  Homework 09


Grade reports tonight will include Stage 01 of Semester Project 

Today: Stage 01 of the Semester Project. 

https://www.cs.indiana.edu/classes/c212-dgerman/sum2018/ports.html

Stage 01 says: install Tomcat. 

http://silo.cs.indiana.edu:27200/

Steps: 

 1. Log into silo. 

 2. Please go into c212-workspace: 

    cd ~

    mkdir c212-workspace 

    cd c212-workspace

Remember this: 

-bash-4.2$ ls
apache  c212-workspace  cleaning-sum-2018  varia
-bash-4.2$ cd c212-workspace/
-bash-4.2$ ls
exercises  JUNIT
-bash-4.2$ ls -ld .setup
-rw-r--r-- 1 dgerman faculty 161 Jul  6 21:05 .setup
-bash-4.2$

 3. Bring the compressed archive for the server into that folder: 

    cp /l/www/classes/a348/spr2013/software/apache-tomcat-7.0.35.tar.gz .

Please don't skip the period at the end that means the current folder. 

Please be in the right folder. 

-bash-4.2$ pwd
/u/dgerman/c212-workspace
-bash-4.2$ ls
exercises  JUNIT
-bash-4.2$ cp /l/www/classes/a348/spr2013/software/apache-tomcat-7.0.35.tar.gz .
-bash-4.2$ ls
apache-tomcat-7.0.35.tar.gz  exercises  JUNIT
-bash-4.2$ ls -l
total 8132
-rw-r--r--  1 dgerman faculty 7784675 Jul 16 12:05 apache-tomcat-7.0.35.tar.gz
drwxr-xr-x 15 dgerman faculty    4096 Jul  7 13:22 exercises
drwxr-xr-x  2 dgerman faculty      35 Jul  6 20:54 JUNIT
-bash-4.2$

 4. Uncompress the archive: 

    gunzip apache-tomcat-7.0.35.tar.gz

-bash-4.2$ pwd
/u/dgerman/c212-workspace
-bash-4.2$ ls -l
total 7608
-rw-r--r--  1 dgerman faculty 7784675 Jul 16 12:05 apache-tomcat-7.0.35.tar.gz
drwxr-xr-x 15 dgerman faculty    4096 Jul  7 13:22 exercises
drwxr-xr-x  2 dgerman faculty      35 Jul  6 20:54 JUNIT
-bash-4.2$ gunzip apache-tomcat-7.0.35.tar.gz
-bash-4.2$ ls -l
total 16324
-rw-r--r--  1 dgerman faculty 12707840 Jul 16 12:05 apache-tomcat-7.0.35.tar
drwxr-xr-x 15 dgerman faculty     4096 Jul  7 13:22 exercises
drwxr-xr-x  2 dgerman faculty       35 Jul  6 20:54 JUNIT
-bash-4.2$

 5. Unarchive the archive: 

    tar xvf apache-tomcat-7.0.35.tar

If the v is missing the process is quiet. 

Now if you want you can delete the archive and focus on the new folder:

-bash-4.2$ ls -l
total 12420
drwxr-xr-x  9 dgerman faculty     4096 Jul 16 12:10 apache-tomcat-7.0.35
-rw-r--r--  1 dgerman faculty 12707840 Jul 16 12:05 apache-tomcat-7.0.35.tar
drwxr-xr-x 15 dgerman faculty     4096 Jul  7 13:22 exercises
drwxr-xr-x  2 dgerman faculty       35 Jul  6 20:54 JUNIT
-bash-4.2$ rm apache-tomcat-7.0.35.tar
-bash-4.2$ ls -l
total 8
drwxr-xr-x  9 dgerman faculty 4096 Jul 16 12:10 apache-tomcat-7.0.35
drwxr-xr-x 15 dgerman faculty 4096 Jul  7 13:22 exercises
drwxr-xr-x  2 dgerman faculty   35 Jul  6 20:54 JUNIT
-bash-4.2$

So so far we know: mkdir, cd, pwd, ls, ls -l, ., tarxvf, gunzip, clear

To copy in PuTTY: just highlight what you want to copy. 

To paste in PuTTY: put the cursor where you need to paste then right-click. 

Also to paste: you can use Shift-Insert after the cursor is in place... 

 6. Add the following to your .setup file:

-bash-4.2$ pwd
/u/dgerman/c212-workspace
-bash-4.2$ ls -l
total 8
drwxr-xr-x  9 dgerman faculty 4096 Jul 16 12:10 apache-tomcat-7.0.35
drwxr-xr-x 15 dgerman faculty 4096 Jul  7 13:22 exercises
drwxr-xr-x  2 dgerman faculty   35 Jul  6 20:54 JUNIT
-bash-4.2$ ls -ld .setup
-rw-r--r-- 1 dgerman faculty 161 Jul  6 21:05 .setup
-bash-4.2$ nano -w .setup
-bash-4.2$ cat .setup
JAVA_HOME=/usr/lib/jvm/java-1.7.0
export JAVA_HOME

CATALINA_HOME=/u/dgerman/c212-workspace/apache-tomcat-7.0.35
export CATALINA_HOME

JUNIT_HOME=~/c212-workspace/JUNIT
export JUNIT_HOME

CLASSPATH=.:$CATALINA_HOME/lib/servlet-api.jar:$JUNIT_HOME/junit-4.10.jar
export CLASSPATH
-bash-4.2$

So use your username and your logistics and make it look (conceptually) like this. 

 7. Source this file: 

-bash-4.2$ cat .setup
JAVA_HOME=/usr/lib/jvm/java-1.7.0
export JAVA_HOME

CATALINA_HOME=/u/dgerman/c212-workspace/apache-tomcat-7.0.35
export CATALINA_HOME

JUNIT_HOME=~/c212-workspace/JUNIT
export JUNIT_HOME

CLASSPATH=.:$CATALINA_HOME/lib/servlet-api.jar:$JUNIT_HOME/junit-4.10.jar
export CLASSPATH
-bash-4.2$ echo $JAVA_HOME

-bash-4.2$ source .setup
-bash-4.2$ echo $JAVA_HOME
/usr/lib/jvm/java-1.7.0
-bash-4.2$

 8. cd $CATALINA_HOME/conf

-bash-4.2$ cd $CATALINA_HOME/conf
-bash-4.2$ pwd
/u/dgerman/c212-workspace/apache-tomcat-7.0.35/conf
-bash-4.2$

 9. Move the server.xml in there to server.xml.distr and create new server.xml

-bash-4.2$ cd $CATALINA_HOME/conf
-bash-4.2$ pwd
/u/dgerman/c212-workspace/apache-tomcat-7.0.35/conf
-bash-4.2$ ls -l
total 200
-rw------- 1 dgerman faculty  12128 Jan 10  2013 catalina.policy
-rw------- 1 dgerman faculty   6392 Jan 10  2013 catalina.properties
-rw------- 1 dgerman faculty   1394 Jan 10  2013 context.xml
-rw------- 1 dgerman faculty   3288 Jan 10  2013 logging.properties
-rw------- 1 dgerman faculty   6435 Jan 10  2013 server.xml
-rw------- 1 dgerman faculty   1530 Jan 10  2013 tomcat-users.xml
-rw------- 1 dgerman faculty 162905 Jan 10  2013 web.xml
-bash-4.2$ mv server.xml server.xml.distr
-bash-4.2$ ls -l
total 200
-rw------- 1 dgerman faculty  12128 Jan 10  2013 catalina.policy
-rw------- 1 dgerman faculty   6392 Jan 10  2013 catalina.properties
-rw------- 1 dgerman faculty   1394 Jan 10  2013 context.xml
-rw------- 1 dgerman faculty   3288 Jan 10  2013 logging.properties
-rw------- 1 dgerman faculty   6435 Jan 10  2013 server.xml.distr
-rw------- 1 dgerman faculty   1530 Jan 10  2013 tomcat-users.xml
-rw------- 1 dgerman faculty 162905 Jan 10  2013 web.xml
-bash-4.2$

Now create the new server.xml:

<Server port="24100" shutdown="SHUTDOWN">

  <GlobalNamingResources>
    <!-- Used by Manager webapp -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">
    <Connector port="24099" />

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase" />
      <Host name="localhost" appBase="webapps" />
    </Engine>

  </Service>
</Server>

Use your ports (larger one on top) and save it. 

Now you invoke nano (an editor) to create a new file: server.xml

The -w switch makes sure that if a line is long the editor won't wrap it.

-bash-4.2$ nano -w server.xml
-bash-4.2$ ls -l
total 204
-rw------- 1 dgerman faculty  12128 Jan 10  2013 catalina.policy
-rw------- 1 dgerman faculty   6392 Jan 10  2013 catalina.properties
-rw------- 1 dgerman faculty   1394 Jan 10  2013 context.xml
-rw------- 1 dgerman faculty   3288 Jan 10  2013 logging.properties
-rw-r--r-- 1 dgerman faculty    736 Jul 16 12:31 server.xml
-rw------- 1 dgerman faculty   6435 Jan 10  2013 server.xml.distr
-rw------- 1 dgerman faculty   1530 Jan 10  2013 tomcat-users.xml
-rw------- 1 dgerman faculty 162905 Jan 10  2013 web.xml
-bash-4.2$ cat server.xml
<Server port="27400" shutdown="SHUTDOWN">

  <GlobalNamingResources>
    <!-- Used by Manager webapp -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">
    <Connector port="27200" />

    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase" />
      <Host name="localhost" appBase="webapps" />
    </Engine>

  </Service>
</Server>
-bash-4.2$

So now I am all set.     

10. $CATALINA_HOME/bin/startup.sh

-bash-4.2$ $CATALINA_HOME/bin/startup.sh
Using CATALINA_BASE:   /u/dgerman/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_HOME:   /u/dgerman/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /u/dgerman/c212-workspace/apache-tomcat-7.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.7.0
Using CLASSPATH:       /u/dgerman/c212-workspace/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/dgerman/c212-workspace/apache-tomcat-7.0.35/bin/tomcat-juli.jar
-bash-4.2$ ps -ef | grep dgerman
dgerman    1542  76643  0 12:23 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman    5156      1  0 May02 ?        00:02:12 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    5157   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    5158   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    5159   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    5160   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    5161   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    5229   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman    6425      1  0 May01 ?        00:02:22 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   15152  76643  0 12:29 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman   20408      1  0 May02 ?        00:00:00 /bin/sh /u/dgerman/05022018/mysql/bin/mysqld_safe --user=yongchu --pid-file=/u/dgerman/05022018/mysql/my...
dgerman   20507  20408  0 May02 ?        00:00:00 /u/dgerman/05022018/mysql/libexec/mysqld --basedir=/u/dgerman/05022018/mysql --datadir=/u/dgerman/050220...
dgerman   31248      1  5 12:36 pts/130  00:00:03 /usr/lib/jvm/java-1.7.0/bin/java -Djava.util.logging.config.file=/u/dgerman/c212-workspace/apache-tomcat...
dgerman   33990 151889  0 12:37 pts/130  00:00:00 ps -ef
dgerman   33991 151889  0 12:37 pts/130  00:00:00 grep --color=auto dgerman
dgerman   35300   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   35518  76643  0 11:09 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman   35519   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   35554   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   35555   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   44855   5156  0 May02 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman   62317   5156  0 May10 ?        00:00:00 /u/dgerman/05022018/apache/bin/httpd -k start
dgerman   76643      1  0 Jun29 ?        00:00:33 /u/dgerman/apache/bin/httpd -k start
dgerman   82865   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   82866   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   82867   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   82868   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   82869   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
dgerman   82969   6425  0 May02 ?        00:00:00 /u/dgerman/a348-spr2018-workspace/apache/bin/httpd -k restart
root      88556   3280  0 11:33 ?        00:00:00 sshd: dgerman [priv]
dgerman   88857  88556  0 11:33 ?        00:00:00 sshd: dgerman@pts/13
dgerman   88858  88857  0 11:33 pts/13   00:00:00 -bash
dgerman  102905  76643  0 11:40 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  113476  76643  0 11:45 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  133461      1  0 Apr24 ?        00:02:32 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133462 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133463 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133464 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133465 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133466 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133488 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133490 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  133491 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  138149 133461  0 Apr24 ?        00:00:00 /u/dgerman/aaron/apache/bin/httpd -k start
dgerman  139405  76643  0 07:27 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  145486  88858  0 11:59 pts/13   00:00:00 nano -w 0716a.phps
root     151066   3280  0 12:02 ?        00:00:00 sshd: dgerman [priv]
dgerman  151882 151066  0 12:02 ?        00:00:00 sshd: dgerman@pts/130
dgerman  151889 151882  0 12:02 pts/130  00:00:00 -bash
dgerman  160428  76643  0 12:05 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  171941  76643  0 12:11 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  172074  76643  0 12:11 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  172075  76643  0 12:11 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
dgerman  179474  76643  0 07:46 ?        00:00:00 /u/dgerman/apache/bin/httpd -k start
-bash-4.2$ ps -ef | grep dgerman | grep c212
dgerman   31248      1  4 12:36 pts/130  00:00:03 /usr/lib/jvm/java-1.7.0/bin/java -Djava.util.logging.config.file=/u/dgerman/c212-workspace/apache-tomcat...
dgerman   34297 151889  0 12:38 pts/130  00:00:00 grep --color=auto c212
-bash-4.2$

To stop it you do this:

-bash-4.2$ $CATALINA_HOME/bin/shutdown.sh
Using CATALINA_BASE:   /u/dgerman/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_HOME:   /u/dgerman/c212-workspace/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /u/dgerman/c212-workspace/apache-tomcat-7.0.35/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.7.0
Using CLASSPATH:       /u/dgerman/c212-workspace/apache-tomcat-7.0.35/bin/bootstrap.jar:/u/dgerman/c212-workspace/apache-tomcat-7.0.35/bin/tomcat-juli.jar
Picked up _JAVA_OPTIONS: -Xms512m -Xmx512m
-bash-4.2$ ps -ef | grep dgerman | grep c212
dgerman   38846 151889  0 12:40 pts/130  00:00:00 grep --color=auto c212
-bash-4.2$

11. Make sure your server is running, if not -- start it, set up home page. 

-bash-4.2$ pwd
/u/dgerman/c212-workspace/apache-tomcat-7.0.35/conf
-bash-4.2$ cd $CATALINA_HOME/webapps/ROOT
-bash-4.2$ ls
asf-logo.png       bg-nav-item.png  favicon.ico        tomcat.gif        WEB-INF
asf-logo-wide.gif  bg-nav.png       index.jsp          tomcat.png
bg-button.png      bg-upper.png     RELEASE-NOTES.txt  tomcat-power.gif
bg-middle.png      build.xml        tomcat.css         tomcat.svg
-bash-4.2$ nano -w index.html
-bash-4.2$ ls -ld index.*
-rw-r--r-- 1 dgerman faculty   141 Jul 16 12:43 index.html
-rw-r--r-- 1 dgerman faculty 12308 Jan 10  2013 index.jsp
-bash-4.2$ cat index.html
Hi my name is Adrian and I like GSPs. <p>

<img src="http://andersoncreekhunting.com/wp-content/uploads/2015/09/DocGSP-NC-003-150x150.jpg">
-bash-4.2$ nano -w index.html
-bash-4.2$ ls -ld index.html
-rw-r--r-- 1 dgerman faculty 216 Jul 16 12:45 index.html
-bash-4.2$ cat index.html
Hi my name is Adrian and I like GSPs. <p>

<img src="http://andersoncreekhunting.com/wp-content/uploads/2015/09/DocGSP-NC-003-150x150.jpg"> <p>

Here's a link to my <a href="index.jsp"><code>index.jsp</code></a>.
-bash-4.2$

--