Win a copy of Rust Web Development this week in the Other Languages forum!

Hentay Duke

Ranch Hand
+ Follow
since Oct 27, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hentay Duke

Sorry I misunderstood. I was getting a can't find symbol error when trying to compile. I thought you were referring to errors when I looked for the class with the env command.

Regardless I finally got it working last night. It was actually a stupid problem, one which was happening because Eclipse was not behaving the way I anticipated. It's actually kind of embarassing.

When creating a Java Project, the organize imports command was unable to find my servlet-api.jar. And I would get the common red underline on the offending classes. So I created a J2EE project and used the organize imports command. I didn't get the red underline and assumed all was well. Well because I wasn't getting any errors in Eclipse I assumed my imports were all taken care of, and never bothered to expand the import section. A stupid rookie mistake, I didn't actually have the servlet package imported. I didn't suspect that since Eclipse didn't complain in J2ee mode the way it did in java mode.

Bottom line is I got my problem fixed. Now I just need to work on why Eclipse doesn't behave the way I thought it should.

I'm sorry if I wasted your time, but thank you for your help and patience anyway.
13 years ago
Doesn't show any errors
13 years ago
It does show the jar file. Even when I run /Library/tomcat/lib/ and it shows the jars listed servlet-api.jar shops up.

Any other ideas?
13 years ago
I got rid of the common folder, and put things back where they were.

Here's the command I running from my project1 directory.

javac -classpath /Library/tomcat/lib/servlet-api.jar -d classes src/

I tried adding classpath using setenv in .bash_profile.

If I run env in the terminal it shows a listing


looks like the classpath includes the servlet-api.jar. But seems like javac can't find it when I compile from terminal.

Is this the way I should be doing it? Pointing to the servlet-api.jar included with tomcat, or is there a better way?
[ February 03, 2008: Message edited by: Hentay Duke ]
13 years ago
I'm using Tomcat 6.0.14, downloaded from one of the mirror sites on Apache. I followed the instructions and got it installed and working no problem. I can start and stop it and view the default tomcat page on my localhost.

I downloaded Eclipse Jee version and when I create a servlet it doesn't have a problem using HttpServletRequest and HttpServletResponse. But when I try to compile from Terminal I get an error because it doesn't recognize the request and response classes.
13 years ago
That was the directory structure tomcat set up when I installed it. I haven't messed around with it. I have now created the common directory and put the lib folder into it.

I'm not sure what you mean by invalid syntax. I'm compiling from my project1 folder, which is under my user account etc... Tomcat is installed in my HD Library folder not in my users Library folder. So I was trying to back out until I got to my root HD and then go to tomcat from there. Does that make sense? If so is that not how I should be doing it?

Judging from my directories listed in my first post. What should my -classpath statement look like when I compile?

Please bear with me, I'm not real experienced with this.
13 years ago
I have tomcat and Eclipse installed and running. I am going through Head First Servlets and JSP, but I can't compile my first servlet. It can't find the servlets-api.jar in tomcat.

I have a directory with my workspace and servlet


Tomcat is installed here


I'm trying to compile through the terminal with this command. My current directory is


javac -classpath /pathToTomcat/lib.servlet-api.jar -d classes src/

for my pathToTomcat I have tried all sorts of things, such as


No matter what I try I just can't get it to compile.
13 years ago
Look at the the indexOf method for String. You'll use something like this
to find the space seperating the first and last name. And then use that index for your substring calls. Of course this assumes you only have a first and last name and not a middle name as well. If there is a middle name you'll need to find the index for both spaces.

[ April 12, 2006: Message edited by: Hentay Duke ]
[ April 12, 2006: Message edited by: Hentay Duke ]
15 years ago
I've tried google but can't seem to find anything on this.

Is it possible to pass a string array in <var-value>. For example something like this (though this doesn't work).

I want to check if any of the fields I'm passing is filled in. And if so they must all be filled in. I can do seperate checks on each one but then I get mutliple(redundant) error messages, so I'd like to pass the array and loop through it in my validator-rules.xml, therefore only having one standard error message if any of them fail.

Hope this makes sense.

15 years ago
Have you tried something like this?

This of course is not an entire working example. Just some lines to give you an idea. And without seeing your code it's hard to say what you need. This may be to basic for your needs.
16 years ago
Assign the last element to tempChar, assign the first element to the last element and assign the tempChar to the first element. Basic stuff!
16 years ago
MacOS 10.0.4. has java installed and ready to go. You will use the Terminal to type in javac just as you would the command prompt.

Edit: there's a mac forum here that will be of help when you get going and have more questions.
[ October 12, 2005: Message edited by: Hentay Duke ]
16 years ago
I believe there are some on this site if you look around, you could also google for "simple java exercises" or something similar. Read through all the threads here and try to do some of the things people have talked about. Think about some simple things on your own. Many programmers have probably done some sort of checking account type system at one point while learning. Think of something that interests you and go for it.
[ September 29, 2005: Message edited by: Hentay Duke ]
16 years ago
Certainly pick which ever book you like the best. The point I would make is that reading "Core Java" and writing beans and servlets probably isn't the best combination. Either you have a good grasp of the core API and need a book more specialized, or you're just starting out and shouldn't worry about beans and servlets quite yet.

Just trying to help make it easier for you.
16 years ago
If you want to concentrate on web apps. A good book to get would be the "Head First Servlets & JSPs".
16 years ago