We help IT Professionals succeed at work.
Get Started

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

stevebowdoin
stevebowdoin asked
on
296 Views
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;                                                        
 res.setContentType("text/html");                                        
 out = res.getWriter();                                                  
 out.println("<html>");                                                  
 out.println("<head><title>Hello World</title></head>");                
 out.println("<body>");                                                  
 out.println("<h1>Hello World</h1>");                                    
 out.println("</body></html>");                                          
 }                                                                      
}                                                                        

Here is how i set Java home and class path:
PGM                                                            
ADDENVVAR  ENVVAR(JAVA_HOME) +                                  
             VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk70+      
             /64bit') REPLACE(*YES)                            
ADDENVVAR  ENVVAR(CLASSPATH) +                                  
             VALUE('/qibm/ProdData/HTTP/Public/jt400/lib+      
             /jt400.jar;/qibm/ProdData/HTTP/Public/jt400+      
             /lib/jt400Servlet.jar;/bcwjava/servlet-api-+      
             2.5.jar;/qibm/ProdData/HTTP/Public/jt400/li+      
             b/jt400Native.jar') REPLACE(*YES)                  
ENDPGM
Comment
Watch Question
Expert for hire: IBM i, AIX, Linux, Windows, DB2, Performance, Security. EDI
CERTIFIED EXPERT
Commented:
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