Re: Importing javax.faces.context.FacesContext for Glassfish
csharpdotcom wrote:
Well, I seem to eventually got it to compile through a series of trial
and
error, as the documentation I found online together with the man and
help
pages were not at all clear. I typed the following:
javac -d web/WEB-INF/classes -classpath "web/WEB-INF/lib/*" \
src/java/com/corejsf/ChangeLocaleBean.java
So the destination folder is specified first with the "-d" option,
then
the classpath, which for some reason has to be in quotes, then the
source
code. It doesn't work when the classpath is not in quotes, and must
have
something to do with the way the shell handles the wildcard. I'm
uaing
bash.
That is only part of the answer, of course. After you've compiled the classes
to web/WEB-INF/classes/ (that is relative to a build/ or dist/ directory,
correct?), you still have to copy the JSPs and HTMLs to web/, the JARs to
web/WEB-INF/lib, then drop to web/ and jar the whole thing into a WAR file for
deployment to your app server.
I usually use web/ as the source directory for web artifacts, src/ as the top
of the source tree, build/ as the target of the build (so that classes go into
build/WEB-INF/classes/, for example), and dist/ as the target directory to
build the WAR file.
project/
|-- src/ <== Java source tree here
|-- web/ <== JSPs, HTMLs, etc.
| |-- WEB-INF/
| | |-- lib/ <== JARs
| | |-- jspf/ <== JSP fragments
| |
| |-- images/ <== other resources
| |-- style/ :
|
|-- build/ <== JSPs, HTMLs, etc., copied to here
| |-- WEB-INF/
| | |-- lib/ <== JARs copied to here
| | |-- jspf/ <== JSP fragments copied to here
| | |-- classes/ <== .class files built here
| |
| |-- images/ <== other resources copied to here
| |-- style/ :
|
|-- dist/ <== WAR file built here
This is in line with what Sun and Apache Tomcat recommend, and how most IDEs
will organize your stuff.
--
Lew