This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Aparently the claspath or the path is not correctly set??

 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am learning from the "Headfirst" series. I must have missed something because:

1. I have no "CATALINA_HOME" in my path (What should it be?

2. I have no "CLASSPATH" in my environment (What should it be?)

3. The compiler can not find either "Http..." nor "println"?

I am a C programmer but this one has me baffled. Any advice for this Java newbie would be welcomed.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CATALINA_HOME is usually the installation directory of Tomcat.

CLASSPATH is an environment variable used by the Java compiler and interpreter to locate .class files. The value of the CLASSPATH is user defined.

If the CLASSPATH environment variable is not set, then the current directory is used as the CLASSPATH.

However, if the CLASSPATH is set, but does not contain the current directory, then the .class files in the current directory cannot be seen by the compiler and interpreter.

Could you be more specific about your third question?
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the rapid replies. When I attempt to compile any ".java" code containing either (or both) "system.out.println(...)" or any reference to any of the "Http functions (post, get), I receive an error that the compiler can not locate "system.out.println" or in the case of anything associated with "Http" functionality, the system error reads that it can not locate ...Http (I do not recall the exact error message).

Would you mind elaborating a bit more about "classpath"? Should I point to the Tomcat path housing my classes or to something else or as the Sun docs mention, leave the environment variable out completely? Oh, Tomcat runs just fine and I was able to compile and run the initial example/exercise in Heads Up Java/JSP (I retreated back to Heads up Java) though.
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exact error relating to the "println" statement is:
"cannot find symbol: method println(java.lang.String, java.lang.String)
location: class.java.io.PrintStream
System.out.println("Ruff", "Ruff");
^
 
Shyam Prasad Murarka
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Readers,
In the println() method of java.io.PrintStream class, Java accepts only a single parameter. But looks like you have specified two parameters which is the cause of the error.
You can modify your code to include concantination like this:



Resultantly one parameter gets passed.
 
Marilyn de Queiroz
Sheriff
Posts: 9063
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't sound like you're reading Head First Java, which is the first book. Are you reading Head First Servlets?
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for the answers. I took the "RUFF" "RUFF" code from page 36 of "HeadFirst Java". To answer the second question: I began with "Head First java" then needed an answer about Http Post and Get so I purchased "Head First Servlets and JSP". I quickly retreated back to the original though and will continue.

I suspect that I am having trouble with my environment and will work on that aspect. I also develop on an Apple and may move over to that.

Many thanks to all who are attempting to assist here.
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Reynolds:
Thank you all for the answers. I took the "RUFF" "RUFF" code from page 36 of "HeadFirst Java". To answer the second question: I began with "Head First java" then needed an answer about Http Post and Get so I purchased "Head First Servlets and JSP". I quickly retreated back to the original though and will continue.

I suspect that I am having trouble with my environment and will work on that aspect. I also develop on an Apple and may move over to that.

Many thanks to all who are attempting to assist here.


You can't make head or tail of it if you plunge headlong into advanced heady stuff; head to Head First Java first and then look ahead.
 
Michael Reynolds
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GOT IT I had to re-install the JDK and the JRE (not seperately of course). Many thanks to all who got me over this silly hump. I have been programming for about 20 years and feel rather silly but it is not the first nor I am sure the last time for that feeling.

Thanks again to all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic