Hello , i am having some problems with 1st example in book. I have done some researches but i haven't found how to solve my problem. When i try to compile that, i get some errors and i don't know what to do
The name of class etc is in Polish language, i hope that is ok for you : P
When i try to compile that with "javac WyborPiwa.java" i get this:
C:\Users\qwerty>cd..
C:\Users>cd ..
C:\>javac WyborPiwa.class
javac: invalid flag: WyborPiwa.class
Usage: javac <options> <source files>
use -help for a list of possible options
C:\>javac WyborPiwa.class
javac: invalid flag: WyborPiwa.class
Usage: javac <options> <source files>
use -help for a list of possible options
The directory of WyborPiwa.class is in C:\WyborPiwa.class
I have already done the xml and html and it's working (moved them to the right folders ;) )
Please help
Krystian Kowalski wrote:Hello , i am having some problems with 1st example in book. I have done some researches but i haven't found how to solve my problem. When i try to compile that, i get some errors and i don't know what to do
The name of class etc is in Polish language, i hope that is ok for you : P
When i try to compile that with "javac WyborPiwa.java" i get this:
C:\Users\qwerty>cd..
C:\Users>cd ..
C:\>javac WyborPiwa.class
javac: invalid flag: WyborPiwa.class
Usage: javac <options> <source files>
use -help for a list of possible options
C:\>javac WyborPiwa.class
javac: invalid flag: WyborPiwa.class
Usage: javac <options> <source files>
use -help for a list of possible options
The directory of WyborPiwa.class is in C:\WyborPiwa.class
I have already done the xml and html and it's working (moved them to the right folders ;) )
Please help
hi
Krystian did you copy and pest this programe..
if yes then just delete this sign " and write again..
i thing nothing any wrong in this servlet..
I have tried to do something in eclipse but i think i just make those things harder for me and now i have completly idead what am i doing ... ;p Can someone help me ?
Here is my html website named form.html:
Here is my web.xml :
And my servlet WyborPiwa.java :
Now i really don't know how to setup this , how to compile etc.. i was trying to use directions from book
I am trying really hard from the morning and nothing ;p Here i sent my eclipse files , mby it would be easier for you guys to check out everything. I really appreciate any help.
I can't add any zip or rar to attachments so i used sendspace :
http://www.sendspace.com/file/8d9p4x
Ditch Eclipse if it only serves to confuse you.
The problem with your first try, compiling the .java file with javac from the command-line, has to do with the illegal characters you use to quote your String literals.
Those seem to be Unicode left double quotation mark (U+201C) and right double quotation mark (U+201D), instead of the required good old ASCII compatible quotation mark (U+0022).
This is probably down to your computers regional settings, which leads to those characters being inserted when you hit the " button on your keyboard.
I have tried to compile that ( " -signs are changed):
with using : javac WyborPiwa.java and that's what i get:
C:\Users\qwerty>cd ..
C:\Users>cd ..
C:\>javac WyborPiwa.java
WyborPiwa.java:3: error: package javax.servlet does not exist
import javax.servlet.*;
^
WyborPiwa.java:4: error: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
WyborPiwa.java:7: error: cannot find symbol
public class WyborPiwa extends HttpServlet {
^
symbol: class HttpServlet
WyborPiwa.java:8: error: cannot find symbol
public void doPost(HttpServletRequest request, HttpServletResponse respo
nse)
^
symbol: class HttpServletRequest
location: class WyborPiwa
WyborPiwa.java:8: error: cannot find symbol
public void doPost(HttpServletRequest request, HttpServletResponse respo
nse)
^
symbol: class HttpServletResponse
location: class WyborPiwa
WyborPiwa.java:9: error: cannot find symbol
throws IOException, ServletException {
^
symbol: class ServletException
location: class WyborPiwa
6 errors
C:\>
I know about error package because -it doesn't exist but i don't really know what else i should change and how
I have done head first java, and i was familliar with eclipse but now i am confused ;/
Krystian Kowalski wrote:I have tried to compile that ( " -signs are changed):
...
with using : javac WyborPiwa.java and that's what i get:
...
6 errors
Seems like the compiler can't find the Servlet API's JAR file.
The Servlet API classes aren't part of the standard JDK. Your best bet would be to look in the lib folder of your servlet container (presumably Tomcat) and get the servlet-api.jar for there.
Then add that JAr file to your buildpath in Eclipse or the classpath on the commandline invocation of javac, and the compiler warnings should disappear.