Hentay Duke

Ranch Hand
+ Follow
since Oct 27, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
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.
11 years ago
Doesn't show any errors
11 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?
11 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/Ch1Servlet.java

I tried adding classpath using setenv in .bash_profile.

If I run env in the terminal it shows a listing

CLASSPATH=.:/Library/Java/home:/Library/tomcat/lib/servlet-api.jar

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 ]
11 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.
11 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.
11 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

/Users/myUserName/Documents/workspace/project1/src/Ch1Servlet.java

Tomcat is installed here

/Library/tomcat/lib/servlet-api.jar

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

/Users/myUserName/Documents/workspace/project1/

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

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

/../../../../../Library/tomcat/

No matter what I try I just can't get it to compile.
11 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 ]
13 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.

Thanks
13 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.
13 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!
13 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 ]
13 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 ]
13 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.
13 years ago
If you want to concentrate on web apps. A good book to get would be the "Head First Servlets & JSPs".
13 years ago