Beginner problem compiling with javac
Hi I am trying to compile a program from a tutorial I am doing.
The program is titled myprogram.java and is located in the c:\src> directory.
When I use the command c:\src>javac myprogram.java I get the following errors.
myprogram.java:1: <identifier> expected
class
^
myprogram.java:8: '>' expected
^
2 errors
and when I try
c:\src> javac src\myprogram.java
I get:
error: cannot read: src\myprogram.java
1 error
I am using windowsXP and jdk1.5.0_06
I have set Path and CLASSPATH in my enviromental variables.
I am sure this is a simple problem, but if anybody would help I would really appreciate it.
Thanks.
[739 byte] By [
paul221a] at [2007-10-2 14:16:42]

From the looks of it your starting you program with class myprogram, correct? if thats the case you need an identifier such as public then class. So it would look likepublic class myprogram
I'm new to this java help stuff but I hope this helps. :)
Hi thanks for the replies. my source code was:
class myprogram {
public static void main(String[] args) {
System.out.println(
"Eureka, I can put Java on my resume.");
}
}
but as soon as i changed it to
public class myprogram {
public static void main(String[] args) {
System.out.println(
"Eureka, I can put Java on my resume.");
}
}
it worked!
Now my new problem when I type
c:\src>java myprogram
i get
Exception in thread "main" java.lang.NoClassDefFoundError: myprogram
Thanks again.
Hi Thanks for the reply. I got the javac command working, and it compiled the file myprogram.class
so heres what I get:
Microsoft Windows XP [Version 5.1.2600]
C:\src>dir
Volume in drive C has no label.
Volume Serial Number is EC47-7752
Directory of C:\src
03/07/2006 04:19 PM<DIR> .
03/07/2006 04:19 PM<DIR> ..
03/07/2006 04:19 PM448 myprogram.class
03/07/2006 04:13 PM157 myprogram.java
2 File(s)605 bytes
2 Dir(s) 16,599,453,696 bytes free
C:\src>java myprogram
Exception in thread "main" java.lang.NoClassDefFoundError: myprogram
Hope you can help.
Thanks again.