Can not compile

Hi!I am very new to java. I am experienced RPG programmer tying to learn. I try to use javac hellojava.java from book. keep saying cannot read. what i did wrong?
[175 byte] By [gtcollectiona] at [2007-11-26 15:31:01]
# 1
What EXACTLY is the error message you are getting. Copy it and paste it here.~Tim
SomeoneElsea at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 2
Can not read: HelloJava.java.
gtcollectiona at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 3
java is case sensitive.HelloJava.java is not the same ashellojava.java
Aknibbsa at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 4
I know. I made sure HelloJava.java in C:\Program Files\Java\jdk1.5.0_02\bintoo. may be wrong location......
gtcollectiona at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 5
> I know. I made sure HelloJava.java in C:\Program> Files\Java\jdk1.5.0_02\bintoo. may be wrong> location......What?
qUesT_foR_knOwLeDgea at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 6
> I know. I made sure HelloJava.java in C:\Program> Files\Java\jdk1.5.0_02\bintoo. may be wrong> location......Have you done any reading about this yet ? Or are you just blindly trying things in hopes that something will work ?
Aknibbsa at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 7
I instaled JDK on my pc and try to compile my first program. book did not say where to put source file
gtcollectiona at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 8
It does not matter where the source file isyou will be in that directory when you compile it.Hopefully that makes sense to you.
Aknibbsa at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 9
then why this message? I copied source like it is in a book.
gtcollectiona at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 10
> then why this message? What message?>I copied source like it is in> a book.
qUesT_foR_knOwLeDgea at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 11
error: cannot read: HelloJava.java
gtcollectiona at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 12
> error: cannot read: HelloJava.javayou are doing this on a command line correct ?if it's windows type dir and paste the resultsif it's a nix box type ls and paste the results
Aknibbsa at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 13

Steps to build a java program

1) create a directory (C:\projects)

2) open notepad, or other editor, and create a java class

public class HelloWorld {

public static void main(String [] args) {

System.out.println("Hello World!");

}

}

3) save the above file as HelloWorld.java (case sensitive)

4) open a command window

5) cd to \projects (or what ever dir you saved HelloWorld.java in)

6) type javac HelloWorld.java

7) type java HelloWorld

Ta Da! you have just run your first java program

If anything doesn't work, post the entire error message here.

~Tim

Edit: Fixed typo

SomeoneElsea at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 14
same error. did all steps. sick of it
gtcollectiona at 2007-7-8 21:47:49 > top of Java-index,Java Essentials,New To Java...
# 15
GOT IT!!!! THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
gtcollectiona at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...
# 16
Above, C:\ProgramFiles\JDK1.xxx...\..\bin should be in the path and the rt.jar & C:\Project should be in classpath
talk2keya at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...
# 17

> C:\ProgramFiles\JDK1.xxx...\..\bin should be in the path

Yes. And we know it is in this case because of reply 15.

> rt.jar & C:\Project should be in classpath

Why?

Don't mess with the CLASSPATH variable. If one is not already defined (as

appears to be the case with the OP), then don't create one. If one is defined (because

of quicktime or whatever), leave it alone. The Java tools don't require any

special CLASSPATH setting.

Instead compile and run withjavac -cp . HelloJava.java

java -cp . HelloJava

pbrockway2a at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...
# 18
Check whether you have read/write access to your file
Nad.a at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...
# 19

hey i know that this is kind of an old subject but i have been having similar problems i think i may have even bought the same book. but when i did what some one else told me to do it came back at me with "javac" is not reconized as an internal or external command, operable program or batch file.

missionintel@comcast.neta at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...
# 20

The error message you got is different - indicating that this is quite a

different problem.

The error message you got is the one given by the Windows operating

system when you ask it to execute a command, but it cannot find the

executable file (program) that the command refers to.

In your case you attempted the command "javac", but Windows does not

know where the "javac.exe" file is on your system.

The solution is described here:

http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html

and in the page that is linked from there:

http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html#Environment

If you get stuck start a new thread because it really is a new problem.

pbrockway2a at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...
# 21
i've done that befor that i get the same problem written at the beginning of the topic.Message was edited by: missionintel@comcast.net
missionintel@comcast.neta at 2007-7-21 16:27:40 > top of Java-index,Java Essentials,New To Java...