This commit is contained in:
Éibhear Ó hAnluain 2017-08-12 20:13:13 +01:00
parent d15993c248
commit 278da55431

View file

@ -0,0 +1,76 @@
#+TITLE: Dude! Where's my Eclipse!?
#+DATE: [2017-08-14 Mon]
#+AUTHOR: Éibhear Ó hAnluain, Version 1
#+EMAIL: eibhear.ohanluain@version1.com
#+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:{} arch:headline
#+OPTIONS: author:t c:nil creator:comment d:(not "LOGBOOK") date:t
#+OPTIONS: e:t email:nil f:t inline:t num:t p:nil pri:nil stat:t
#+OPTIONS: tags:t tasks:t tex:t timestamp:t toc:t todo:t |:t
#+CREATOR: Emacs 24.5.1 (Org mode 9.0)
#+DESCRIPTION: A java bootcamp module on building an app for tomcat with just the command-line
#+EXCLUDE_TAGS: noexport
#+KEYWORDS:
#+LANGUAGE: en
#+SELECT_TAGS: export
* Dude! Where's my Eclipse
** Pre-requisites
You will need a linux server with the following installed:
- tomcat :: This demo was prepare with tomcat-8.
- tomcat manager :: Used for deploying the your built application
- A web browser :: for accessing the tomcat manager
- git :: to access the project
- a text editor :: to fix any bugs you find (*Not* =eclipse=,
because that's the whole point.)
- java 8 JDK :: to build code
If you develop on one machine and deploy to the other, then
*tomcat* and *tomcat manager* are to be on the system you're
deploying to, and the rest where you're developing.
If your development environment is not on the same server as the
*tomcat* instance, you'll need a copy of the file
=tomcat8-servlet-api.jar= on the same system as your java code.
** Setting up
0. [@0] All commands assume a Linux environment. =${HOME}= refers
to the home directory of the user, and =${DEV_HOME}= refers to
where the git repository has been cloned to.
1. Get the code
: git clone https://gitlab.com/eibhear/javaBootcampNoEclipse.git
The repository is now in =${DEV_HOME}=. Change into it:
: export DEV_HOME=$(pwd)/javaBootcampNoEclipse
: cd ${DEV_HOME}
2. Make sure you're at the starting point:
: git checkout lesson-1
** Lesson 1 -- compile the code.
*** Starting point
A clean git working area
*** Goal
Java files compiled into class files
*** Steps
0. [@0] Confirm you can access the java compiler:
: javac -version
If this doesn't result in a message like =javac 1.8.0_141=,
you'll need to find where =javac= installed and place it on
your =${PATH}=.
1. Change to where the code is:
: cd ${DEV_HOME}/source/java/org/gibiris/javaBootcampNoEclipse
2. Compile the files:
: javac *.java
3. Check the errors. If you see the message =error: package
javax.servlet does not exist=, then look at your =CLASSPATH=
setting, as dependend libraries are missing.
4. Fix your =CLASSPATH= and compile the java files:
: export CLASSPATH=/usr/share/java/tomcat8-servlet-api.jar:${CLASSPATH}
: javac *.java
5. If the successful, you will have the following additional files:
: ${DEV_HOME}/source/java/org/gibiris/javaBootcampNoEclipse/MyHelloWorldBean.class
: ${DEV_HOME}/source/java/org/gibiris/javaBootcampNoEclipse/MyHelloWorldServlet.class
If this is the case, move on to lesson 2:
: git checkout lesson-2