Hi!
All that you need to do your work is like this:
import java.util.Date;
public class Clock2 extends Thread {
public static void main( String [] args ) {
new Clock2( );
}
public Clock2( ) {
this.start( );
}
public void run( ) {
while( true ) {
try {
Date d = new Date();
System.out.println( d.toString( ) );
this.sleep( 1000 ); // Wait a second for next step...
} catch( Exception e ) {
System.err.println( "Error occurred: " + e.toString( )
);
}
}
}
}
This is a fully functional program.
Note that this program have a public static void main(String [] args) required as
"entry point" for java Apps.
I think that this solve your problem for start coding.
And, about classpath, if you are using Java 2 plataform, clear your classpath, because
you dont need this. If you are using JDK 1.x, put in your classpath the path for
classes.zip and . ( /jdk/lib/classes.zip:. ).
Edson Richter
----------
From: [EMAIL PROTECTED]
Sent: terça-feira, 4 de janeiro de 2000 02:24
To: [EMAIL PROTECTED]
Subject: How do you use JDK?
This might sound ignorant, but everything I've read is about
java programming syntax and stuff like that. My question is
how do you run a java program? Just using java ./Clock2 doesn't
work. I either get "class not found" or "In class Clock2: void
main(String argv[]) is not defined" I've added every directory
in jdk118_v1 to my CLASSPATH and PATH and nothing works. If I try
jre ./Clock2 I get "In class main: public static void main(String
args[]) is not defined." I get these same errors for every demo
I try. There must be something very simple that I am missing.
Every demo ever written can't be broken. Whats the trick? I am
running Mandrake 6.1 and it doesn't include kaffe. Thanks for
any info you can give me. Especially if someone could point me
to some documentation more informative than:
"Running Java on Linux is about what you'd expect. You should be
able to run most "pure Java" applications on the Linux JDK or JRE.
It does take a little longer to get the latest JDK on a target
that Javasoft doesn't officially support."
That little nugget from the FAQ tells me nothing usefull. I have
no idea what to expect other than jre filename or java filename
and something happens. But it ain't happening for me.
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]