[Bluej-discuss] bluej-discuss Digest, Vol 40, Issue 13
Chris Share
cshare01 at qub.ac.uk
Wed Oct 11 10:56:36 BST 2006
Thanks, that's an interesting idea. I'll give it a go.
Cheers,
Chris
Stephen Bloch wrote:
> Chris Share wrote:
>
>> > I'm new to BlueJ. I'm a C programmer using Java/BlueJ for some
>>
>>> prototyping.
>>>
>>> I was wondering if there was a way to run a project's main method
>>> using
>>> key commands?
>
>
> to which Todd O'Bryan replied with various helpful tips, and Chris replied:
>
>>Thanks, I was hoping for a key command like F5...
>>
>>Also, it's a pain to have to set the args each time.
>
>
> It occurs to me that for prototyping purposes, Chris may not need a
> "main" method at all. One of BlueJ's nicest features is the ability
> to invoke ANY method directly, either from the CodePad or with the
> mouse.
>
> So if you want to test a whole app that doesn't care about
> command-line arguments, write a static method that takes no arguments
> and does all the work, and invoke it directly (without worrying about
> setting args, since there are none). Once the program is tested and
> debugged and you need to deliver it to non-BlueJ-users, add a "public
> static void main(String[] args)" method that just calls your previous
> method.
>
> Even better, if you want to test only a part of the program, you can
> do that by calling the method in question directly, rather than
> writing a main method that calls it.
>
More information about the bluej-discuss
mailing list