This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello expert people, i am wondering if there is a way to make the class into non-static : i mean this "public static class CronTask implements org.quartz.Job" into "public class CronTask implements org.quartz.Job". If i try without static identifier then an exception will be thrown, "org.quartz.SchedulerException : Problem instantiating class 'backup_pro$CronTask'". I dont want to use static because if i use that, i should change all my instance method into class method.
I guess you simply have to spend it a separate file, because there must be only one public class per file. Alternatively make the class non-public. I don't know whether this is a real option.
Editing your posting and spending some blanks in the long lines will make it better readable (they allow line-breaks). And using code-tags is much more fun, if you use indentation - preferably real tabs like everybody knows And perhaps you rethink the benefits of import-statements. (The lines aren't broken, as long as your long lines force a very wide page to be drawn.)
[ March 11, 2005: Message edited by: Stefan Wagner ]
Arifin -- we went through this a couple of weeks ago -- you're still trying to figure it out?
Stefan's rewriting won't help. The problem is that this framework wants to call newInstance() on the Class object, and it can't if the inner class is non-static, because at the bytecode level, a non-static inner class has no default constructor, only one that takes an outer-class instance.
You absolutely have to make CronTask a static inner class, or a top-level class; there's no way around that. But what you can do is try to think of some other way to make the instance of backup_pro available to the CronTask object after it's constructed. Can you store the backup_pro object in a static variable somewhere? Can CronTask simply create its own instance? I'm sure you can think of more alternatives. In any case, you have to let the framework do what it needs to do, and that means you have to provide a Task that has a default constructor at the bytecode level. Concentrate on figuring out how to work with that rather than against it.