Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

j2ee starting help 1

Status
Not open for further replies.

portagal

Programmer
Jul 28, 2004
32
CA
Hi, I am trying to learn how to write a selvlet, I have downloaded J2ee, but I cannot compile my servlet class. The errors consist of "pakage javax.servlet does not exist,pakage javax.servlet.http does not exit" and other error form same catagory. I suspected it may be related to setting up the classpath. Could anyone help me please?
 
You need to add j2ee.jar to your CLASSPATH.

If in DOS :

set J2EE_HOME=C:\path\to\J2ee\install\directory
set CLASSPATH=%CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar

If in linux/unix :

export J2EE_HOME=/path/to/J2ee/install/directory
export CLASSPATH=$CLASSPATH:$J2EE_HOME\lib\j2ee.jar

--------------------------------------------------
Free Database Connection Pooling Software
 
Thank you Sedj. I set up my classpath and now I can compile my file, but the fact is before your posting I have played with my classpath and path variable and I think I have scrowed something up because now I cannot run my classes even those which doesn’t need j2ee and were working fine with j2se. I am writing the current value for my path and class path variable if you can help me to get over this it would be much appreciated.
my j2se is in c:\j2sdk1.4.2_03 directory
my j2ee is in c:\Sun\AppServer

current value for PATH in user variable is: c:\j2sdk1.4.2_03
current value for CLASSPATH in system variable is: .;C:\j2sdk1.4.2_03.;C:\Sun\AppServer\lib\j2ee.jar

And the errors I get when I try to run my classes:
-Error opening registry key ‘software\javasoft\java runtime environment’
-Error: could not find java.dll
-Error: could not find java 2 Runtime environments.

Eagerly waiting
 
Altering the CLASSPATH (note separate to PATH) environment variable will not cause the errors you are seeing.

The errors you see seem to be due to :

- an incorrect or corrupt installation
- a JAVA_HOME or PATH env var pointing to another Java install.

You should set the following env var's (example):

set JAVA_HOME=c:\j2sdk1.4.2_03
set PATH=%JAVA_HOME%\bin;%PATH%
set J2EE_HOME=C:\path\to\J2ee\install\directory
set CLASSPATH=%CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar;C:\any_other_jars\a.jar


--------------------------------------------------
Free Database Connection Pooling Software
 
Thank you Sedj. I solved the problem by setting the JAVA_HOME to c:\j2sdk1.4.2_04\jre\bin since the java.exe is in this directory and now everything seems fine.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top