Lecture notes for Tue Jul 18. 

Here's my program: 

public class Jiang {
  public static void main(String[] args) {
    System.out.println( new java.util.Date() );  
  }
}

This is how it runs: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run Jiang
Tue Jul 18 12:13:47 EDT 2017


You have a web server. 

Log into silo. Activate .tomcat-settings (source the file). 

Then go into webapps and create a context. Then cretae a simple JSP and test it. 

Here's how this looks in Kefei's account: 

[kehe@silo ~]$ cd c212-workspace/
[kehe@silo c212-workspace]$ cat .tomcat-settings
JAVA_HOME=/usr/lib/jvm/java-1.8.0
export JAVA_HOME

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

CLASSPATH=.:$CATALINA_HOME/lib/servlet-api.jar
export CLASSPATH
[kehe@silo c212-workspace]$

So now I activate this: 

[kehe@silo c212-workspace]$ echo $JAVA_HOME

[kehe@silo c212-workspace]$ source .tomcat-settings
[kehe@silo c212-workspace]$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0
[kehe@silo c212-workspace]$

Next I create the context: 

[kehe@silo c212-workspace]$ cd $CATALINA_HOME
[kehe@silo apache-tomcat-7.0.35]$ cd webapps/
[kehe@silo webapps]$ ls -l
total 8
drwx------ 13 kehe students 4096 Jul 17 15:51 docs
drwx------  6 kehe students  107 Jul 17 15:51 examples
drwx------  5 kehe students  111 Jul 17 15:51 host-manager
drwx------  5 kehe students  131 Jul 17 15:51 manager
drwx------  3 kehe students 4096 Jul 17 15:51 ROOT
[kehe@silo webapps]$ mkdir fatman
[kehe@silo webapps]$ cd fatman/
[kehe@silo fatman]$ mkdir WEB-INF
[kehe@silo fatman]$ cd WEB-INF/
[kehe@silo WEB-INF]$ mkdir lib
[kehe@silo WEB-INF]$ mkdir classes
[kehe@silo WEB-INF]$ cd ..
[kehe@silo fatman]$ tree .
.
└── WEB-INF
    ├── classes
    └── lib

3 directories, 0 files
[kehe@silo fatman]$ 

My context is mainly empty but functional. 

[kehe@silo fatman]$ ls -l
total 0
drwx------ 4 kehe students 44 Jul 18 12:21 WEB-INF
[kehe@silo fatman]$ nano -w index.jsp
[kehe@silo fatman]$ ls -ld index.jsp
-rw------- 1 kehe students 94 Jul 18 12:24 index.jsp
[kehe@silo fatman]$ cat index.jsp
This is my first JSP. It shows the current time. <p>

The time is: <%=new java.util.Date()%>
[kehe@silo fatman]$

Let's see if this works online: 

http://silo.cs.indiana.edu:11737/fatman/

We're done. 

--