Newbie Questions: so be gentle..

OK, I am a newbie to Java and have absolutely no idea what I am doing, so I am going to ask some stupid questions.

I understand the syntax and all that, but I am having trouble with the basic stuff like the app server and all that.
Here goes:

I have ColdFusion installed, which runs on JRun4, then I also have Sun j2eesdk-1_4_01 installed.

1: Can I get rid of one app server and just run everything on JRun4?
2. Is one better than the other?
3. I am trying to compile a class, but keep running into errors, I know why I get the errors, I get the errors because the class I am trying to compile cannot find the classes I need to import.
   3.a. Where in gods name do I put my classes so it can find all the import classes?
   3.b. I am guessing somewhere under one of the app servers, but which one and where?

The class looks like the following:

package jrun.support;

import javax.servlet.*;
import javax.servlet.http.*;

public class JRunHttpSessionListener implements HttpSessionListener
{
    public void sessionDestroyed( HttpSessionEvent session )
    {
        HttpSession objSession = session.getSession();
        System.out.println(" (objSession) Destroyed:ID=" + objSession.getId());
    }
}

I have a ton load of other questions, but I'll start with the above.
PS. I am trying to perform an action upon timeout of a session variable.
LVL 17
Tacobell777Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vikraman_bCommented:
Hi
can u post ur errors
0
vikraman_bCommented:
check this..
for installating,deployment and configuration....


http://www.macromedia.com/support/coldfusion/j2ee/phase2-jrun4-deploy.html
0
Tacobell777Author Commented:
Following are the errors, just a FYI there are 5 questions in my post and a link to install or deploy just won't do..

C:\Sun\AppServer\jdk\bin>javac e:\temp\JRunHttpSessionListener.java -classpath C
:\Sun\AppServer\docs\api
error: cannot read: e:\temp\JRunHttpSessionListener.java
1 error

C:\Sun\AppServer\jdk\bin>javac C:\JRun4\servers\default\default-ear\default-war\
WEB-INF\classes\JRunHttpSessionListener.java
C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes\JRunHttpSession
Listener.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes\JRunHttpSession
Listener.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes\JRunHttpSession
Listener.java:6: cannot resolve symbol
symbol  : class HttpSessionListener
location: class jrun.support.JRunHttpSessionListener
public class JRunHttpSessionListener implements HttpSessionListener
                                                ^
C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes\JRunHttpSession
Listener.java:8: cannot resolve symbol
symbol  : class HttpSessionEvent
location: class jrun.support.JRunHttpSessionListener
    public void sessionDestroyed( HttpSessionEvent session )
                                  ^
C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes\JRunHttpSession
Listener.java:10: cannot resolve symbol
symbol  : class HttpSession
location: class jrun.support.JRunHttpSessionListener
        HttpSession objSession = session.getSession();
        ^
5 errors
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

vikraman_bCommented:
Hi Tacobell777 ,

The best way to avoid these errors is ..
The following instruction will make to create the war file and it also avoid all servlet/jsp related compile errors also u can add exteral jars too..to automatically set the classpath.
pls follow....

http://www-106.ibm.com/developerworks/opensource/library/os-ectom/

then after choosing the tomcat project ..now write click to create a new class..e.g
JRunHttpSessionListener (ur code)
 if u want to add external jars ..just right click on ur project the click the propties then select the javabuild path (left frame) then select the libraries tab the click the add external jars button ..browse to get the jar then click OK.

After finish coding -->click project menu-->and select the Rebuild All.

It will compile successfully and put all the classes in under WEB-INF/classes directory.

if u want to create a war of this project just right click on the project and select TOmcat project the select the Export the WAR file sets in project properties..

u can the specify the path where u need to put ur war file..
right click ur project  select properties then select the tomcat node and select the Export to War settings tab..there u can browse to select ...

Hope this will help to solve all ur compilation issues ..It will be the best way to do..without any help also it will point out the errors and it will give the possible solutions..A Good IDE

All the best
ANy doubts u ask me..



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomgalloCommented:
Taco,

I agree with vikraman_b. Eclipse is the best IDE for Java/Tomcat use that I ever tried.
However focusing in your questions, more especifically the third:
You have to create an enviromental variable that is CLASSPATH, in this variable we put all the paths to our classes to compile ours .java and do the imports correctly.
If you want, you can use packages. These are subdirs that have classes in it or more subdirs with classes. To use packages you have also to put the paths in the CLASSPATH.

Hope this solve the compilation errors.
-tom

PS: give Eclipse a try... I love it!
0
tomgalloCommented:
Taco,
Another comment... do not worry at all... app servers are not the basic stuff... they are a pain in the a.. hard to configure at the beginning, and also hard to understand.
One piece of advice, be patient, read a lot and try everything!!!

Welcome to Java, hope you enjoy!
-tom

0
lilian-arnaudCommented:
Try ant (http://ant.apache.org/) to compile your java files and deploy your webappli in your app server.

Ant and its build.xml file replace the command "make" and his makefile for java ...
0
drjustinCommented:
Since you are a newbie, app server is just not the thing you want to look at.
Here are some instructions on how to do J2EE in a lightweight way - but still with all the power of real enterprise app.

If you don't know about Spring (www.springframework.org) now is the time to look at it. It covers all things that you are looking for - easy db integration, transaction handling, UI, configuration, documentation, forums, ... It has steep lurning curve, but all this stuff mentioned really helps and once you master it, there's no limit to what you can do :-).

All things below are already integrated with Spring:

- db integration (db independent - only jdbc driver limitations):
  - simple sql mapping: iBatis (www.ibatis.com)
  - more advanced ORM tool: Hibernate (www.hibernate.org)

- user interface:
  - most widely spread: Struts (struts.apache.org/)
  - easy usage: WebWork (www.opensymphony.com/webwork)
  - component oriented: Tapestry (jakarta.apache.org/tapestry)
  - integrated: Spring MVC (www.springframework.org/docs/reference/mvc.html)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.