hii
i have wrote the following code --
==================================================================
package org;
import java.util.Calendar;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
/**
* @author user1
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>
Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
class MainApplication {
public static void main(
String[] args) {
Timer timer = new Timer();
Calendar date = Calendar.getInstance();
// date.set( Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
date.set(Calendar.HOUR, 17);
date.set(Calendar.MINUTE, 12);
date.set(Calendar.SECOND, 0);
date.set(Calendar.MILLISECOND, 0);
// Schedule to run every Sunday in midnight
ReportGenerator obj = new ReportGenerator();
timer.schedule(obj,date.getTime(),1000);
}
}
class ReportGenerator extends TimerTask {
public void run() {
System.out.println("Generating report");
//TODO generate report
}
}
=======================================================================
IT GOT COMPILLED SUCCESSFULY
BUT FOLLOWING ERROR IS COMMING
================================
C:\amit\amit\org>java MainApplication
Exception in
thread "main" java.lang.NoClassDefFoundError: MainApplication (wron
g name: org/MainApplication)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
C:\amit\amit\org>
===================================
Y THIS ERROR IS COMMING ???
can anybody guide me please..... how to succesfully run the progrom..
later i will insert this code in
servlet...
thanx and regards,
amit