We help IT Professionals succeed at work.
Get Started

What is the proper method to reference javax.servlet on and AS/400?

stevebowdoin asked
Last Modified: 2015-03-01
I have some Java code i downloaded and i am trying to compile it on the 400.
I get "package javax.servlet does not exist"

i STRQSH, then ...

> cd /bcwjava                                                              
> ls                                                                        
  Hello.java              jqaj.txt                                          
  HelloWorldServlet.java  servlet-api-2.5.jar                              
> javac HelloWorldServlet.java                                              
  HelloWorldServlet.java:1: error: package javax.servlet does not exist    
  import javax.servlet.*;                                                  

Here is all the Java code:
import javax.servlet.*;                                                  
import javax.servlet.http.*;                                            
import java.io.*;                                                        
public class HelloWorldServlet extends HttpServlet{                      
public void doGet (HttpServletRequest req, HttpServletResponse res)      
 throws ServletException, IOException                                    
 PrintWriter out;                                                        
 out = res.getWriter();                                                  
 out.println("<head><title>Hello World</title></head>");                
 out.println("<h1>Hello World</h1>");                                    

Here is how i set Java home and class path:
ADDENVVAR  ENVVAR(JAVA_HOME) +                                  
             /64bit') REPLACE(*YES)                            
ADDENVVAR  ENVVAR(CLASSPATH) +                                  
             b/jt400Native.jar') REPLACE(*YES)                  
Watch Question
Expert for hire: IBM i, AIX, Linux, Windows, DB2, Performance, Security. EDI
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE