Forums Register Login

error in the source file

+Pie Number of slices to send: Send
I tried a servlet program where i placed the .java file in bin and in the source. I tried compiling both. It shows error in import javax.servlet, http methods. What is the reason for these errors?
+Pie Number of slices to send: Send
What do the errors say? What do you mean by this:


where i placed the .java file in bin




+Pie Number of slices to send: Send
Not sure what you mean by "bin", but it doesn't sound like the right place for source files. How are you adding the jar file that contains the javax.servlet and javax.servlet.http packages to the classpath?
+Pie Number of slices to send: Send
I tried to create class file first in src inside webapps/.../src/Helloworld.java and then tried keeping the source file inside bin I also tried keeping the source file inside d: setting home,path and class path. Please let me know the correct procedure.
+Pie Number of slices to send: Send
which package should i add i mean which jar file should i add other than servlet-api.jar and where should i add it?
+Pie Number of slices to send: Send
It doesn't matter where the source files are, but whatever "bin" is (I can't tell from your post), it sounds like a place for binaries, not source code.

For compiling servlets you don't need anything else but servlet-api.jar in the classpath. You can achieve that by compiling somewhat like this:

javac -cp "c:\this\is\the\path\to\servlet-api.jar" MyServlet.java

This assumes that the .java file is in the current directory, and that there are no complications arising from packages. If there are, then this may help: http://download.oracle.com/javase/tutorial/java/package/managingfiles.html
+Pie Number of slices to send: Send
hi all,
Thanks for your effort. I just found out the silly mistake which i did with setting home and classpath. Its working fine now.
I once met a man from Nantucket. He had a tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1484 times.
Similar Threads
How to modify classpath ?
Unix With Java....
Loading and instantiating a remote class?
How to run Servlet program on Eclipse.?
Cant compile my java files on DOS
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:04:04.