+ Start a Discussion
Vaibhav ShettiVaibhav Shetti 

Batch Apex save error in Eclipse Neon with Force.com IDE

I am trying to demonstrate batch apex in Eclipse Neon with Force.com IDE. Following is the code -

global class BatchApexDemoClass1 implements Database.Batchable<Sobject> {
 global Database.QueryLocator start(Database.BatchableContext bc) {
    return Database.getQueryLocator([Select LeadSource From Lead]);
 }

 global void execute(Database.BatchableContext bc, List<Lead> scope) {
    for (Lead Leads : scope) {
        Leads.LeadSource = 'Dreamforce';
    }
    update scope;
 }    

 global void finish(Database.BatchableContext bc) { 
    System.debug('Batch apex execution complete.');
 }    
}

However, when I save the code, I get the following errors-
- Save error: Class BatchApexDemoClass1 must implement the method: void Database.Batchable.finish(Database.BatchableContext)
- Save error: Class BatchApexDemoClass1 must implement the method: void Database.Batchable.execute(Database.BatchableContext, List)
- Offline Mode. File only saved locally, not to server
- Save error: Class BatchApexDemoClass1 must implement the method: System.Iterable Database.Batchable.start(Database.BatchableContext)

I don't know what am I missing in the code.
NagendraNagendra (Salesforce Developers) 
Hi Vaibhav,

Your code saves correctly when creating via Setup > Apex Class. But the Offline Mode is an issue within Eclipse. A quick Google search turns up this developer guide page https://developer.salesforce.com/docs/atlas.en-us.eclipse.meta/eclipse/ide_pro_work_offline.htm

By default, the Force.com IDE creates projects in offline mode. When you work in offline mode, you avoid compiling your org’s Apex code each time you save your files. If, however, you have a stable Internet connection and a small- to the medium-sized code base, consider toggling your projects to online mode.

Toggle Between Offline and Online Modes Right-click your project in the Package Explorer and choose Force.com, and then select the mode in which you want to work.

Hope this helps.

Thanks,
Nagendra
Vaibhav ShettiVaibhav Shetti
Hi Nagendra,
I have tried this. But still same error 

Batch apex save error in Eclipse neon with Force.com IDE

What about the other errors? Are they also related to Offline mode?