java -cp [classpath] [class file]
Classpath needs to include all JAR files (and CLASS files) that will be needed by the program to run.
Class file specifies the name of the Java class with a main() method that you wish to execute.
http://www.google.com/url?sa=t&ct=res&cd=4&url=http%3A//www.redbrick.dcu.ie/help/reference/JDK.1.1.8-docs/tooldocs/win32/java.html&ei=4-weQ5jCLMu-iwHSjryXDA
- Saish
> I have downloaded all items I was told to download
> and I wrote a program in the notepad but how do I run
> that program?
What is the name of the program you wrote? It should end in .java and match the name of the class you defined within the file. Let's say you created a class Foo saved in a file Foo.java.
[code]
class Foo {
static final public void main(final String[] args) {
System.out.println("Hello world");
}
[code]
You would have to compile your file with javac. You would then execute the CLASS file it using java.exe or java (Unix executable).
I recommend you follow the tutorial here: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html to get started.
- Saish
Sorry, messed up the formatting tags:
class Foo {
static final public void main(final String[] args) {
System.out.println("Hello world");
}
}
- Saish