• Post Reply Bookmark Topic Watch Topic
  • New Topic

Classpath issue with HF Servlets & JSP  RSS feed

 
dav mccartney
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working through the Head First JSP book, and all has been going well. However, they're working through breaking things up MVC-wise (chapter 3ish), and now I'm having some problems I was hoping you might be able to help me with.

#1) When executing the following command:

C:\hfj\beerV1>javac -classpath d:\Portable\Pillar\servlet-api.jar:classes:. -d classes src/com/example/model/BeerExpert.java

I get the following error:

Note: src/com/example/model/BeerExpert.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.


But, the file still appears as a .class in my C:\hfj\beerV1\classes\com\example\model directory as expected.
Is this a problem?

# 2) When I execute ths command:
C:\hfj\beerV1>javac -classpath d:\Portable\Pillar\servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

I get the following 9 errors:
src/com/example/web/BeerSelect.java:6: package com.example.model does not exist
import com.example.model.*;
^
src/com/example/web/BeerSelect.java:7: package javax.servlet does not exist
import javax.servlet.*;
^
src/com/example/web/BeerSelect.java:8: package javax.servlet.http does not exist

import javax.servlet.http.*;
^
src/com/example/web/BeerSelect.java:12: cannot find symbol
symbol: class HttpServlet
public class BeerSelect extends HttpServlet{
^
src/com/example/web/BeerSelect.java:13: cannot find symbol
symbol : class HttpServletRequest
location: class com.example.web.BeerSelect
public void doPost (HttpServletRequest request, HttpServletResponse response
) throws IOException, ServletException{
^
src/com/example/web/BeerSelect.java:13: cannot find symbol
symbol : class HttpServletResponse
location: class com.example.web.BeerSelect
public void doPost (HttpServletRequest request, HttpServletResponse response
) throws IOException, ServletException{
^
src/com/example/web/BeerSelect.java:13: cannot find symbol
symbol : class ServletException
location: class com.example.web.BeerSelect
public void doPost (HttpServletRequest request, HttpServletResponse response
) throws IOException, ServletException{

^
src/com/example/web/BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src/com/example/web/BeerSelect.java:20: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
9 errors


If necessary, I've got a .zip file of the directory structure I have setup, and I would love any suggestions or feedback. Their book was written using OS X, so since I'm on XP I'm not sure it there's something syntaxwise I need to do with the classpath statement, but I suspect that's where the problem is.

Thanks in advance!
David
 
dav mccartney
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I figured it out finally. Turned out to be a combination of using : instead of ; and using the 1.5 sdk instead of 1.4.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!