function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RedSalesRedSales 

How to run my class from within Force.com IDE?

Hello,

 Note I am very new to Force.com/Apex/Salesforce.  I received some very good tips in my earlier question 

"Using System.deb​ug('hello'​); Gives "expecting a right parenthese​s" error?" from sebcos on learnign Apex classes & triggers etc.

The referenced links were as follows:

 

Review the Apex Developer guide and in particular the section which explains Apex classes: 

http://www.salesforce.com/us/developer/docs/apexco​de/Content/apex_classes_understanding.htm

 

and the one which compares Apex to Java:

http://www.salesforce.com/us/developer/docs/apexco​de/index_Left.htm#StartTopic=Content/apex_classes...

 

and the one which explains triggers:

http://www.salesforce.com/us/developer/docs/apexco​de/index_Left.htm#StartTopic=Content/apex_trigger...

 

The documents are very good.

 

However I'm still a bit confused by something.  I have created a class just to test out some basic Apex functions. I have one method within which I test out the functions. I also have a static method in which I create an instance of my class & from this instance call the method (within which my functions exist).  I have no SQL updates & do not want to interact with any stored objects (I just want to get familair with functions so I'm giving dummy string values etc...)

 

My code compiles correctly so that is all good. I'm wondering though how I can I then run the class to test what happens. I have some System.debug functions used & I'd like to see the output.  As I am developing this on my sandbox it is not for production use.

 

If I click on "Run" from the Force.Com IDE menu it then has option for "External Tools", In which there are options for "Run As", "External Tools Configurations", and "Organize Favourites". The "Run As" option's sub option is greyed out.

 

As I have no DB interactions & no requirement to interact with any objects I don't think I need to use a trigger to invoke my class (from reading the documentation triggers seem to interact with DB calls). Other class invoking options I see are to use a Scheduler, Anonymous Blocks or AJAX.

 

If running a similiar Java application/program in eclipse I'd just choose Run As -> Java Application.

 

i guess this may be due to my lack of familiarity with cloud based development, but how do I actually run my application to see the output? 

 

Any suggestions would be welcome & apologies for my lack of understanding on this (even after reading the docs).

 

Thanks in Advance!

 

 

 
Best Answer chosen by Admin (Salesforce Developers) 
sebcossebcos

Hi,

I would suggest to try Anonymous blocks to try out the Apex language.

It's a webservices call that lets you test bits of code like system.debugs and more. 

You can also execute class methods or fire triggers by manipulating records but be careful those changes are permanent.

You can run execute anonymous either from Eclipse:

http://wiki.developerforce.com/index.php/An_Introduction_to_Force_IDE 

 

or from the app itself (top right corner - drop down menu under you username : system log):

https://na2.salesforce.com/help/doc/user_ed.jsp?section=help&target=code_system_log_using.htm&loc=help&hash=topic-title .

 

Hope this helps. 

.

 

All Answers

sebcossebcos

Hi,

I would suggest to try Anonymous blocks to try out the Apex language.

It's a webservices call that lets you test bits of code like system.debugs and more. 

You can also execute class methods or fire triggers by manipulating records but be careful those changes are permanent.

You can run execute anonymous either from Eclipse:

http://wiki.developerforce.com/index.php/An_Introduction_to_Force_IDE 

 

or from the app itself (top right corner - drop down menu under you username : system log):

https://na2.salesforce.com/help/doc/user_ed.jsp?section=help&target=code_system_log_using.htm&loc=help&hash=topic-title .

 

Hope this helps. 

.

 

This was selected as the best answer
calsoftlabscalsoftlabs

i am new to this force.com , suppose i just want to develope and deploy and run a web app like loginapplication , how i will do that in force.com IDE? can any one help me 

 

thanks

diganta