Menu

#209 F2 fails when arguments expected.

open
nobody
None
2
2004-06-01
2004-05-28
Anonymous
No

F.ex: Run the following code with F2-key.

public class A{

public static void main(String[] args){
if (args.length<1){
throw new RuntimeException("Missing Args");
}
else{
for(int i= 0;i<args.length;i++){
System.out.println(args[i]);
}
}
}
}

This behaviour should be documented at the very least.
If a popup box was used to take in the arguments, a
run-button could be used.
I was actually surprised to find the F2 functionality
because I thought the run button was not desired as to
the problem with the argument passing. Since its there
should it not be made fully?

Discussion

  • Neal Horowitz

    Neal Horowitz - 2004-05-28

    Logged In: YES
    user_id=697810

    This was discussed last year, when we added the "run"
    feature. As you say, there is no run button, because we
    didn't really want to encourage the use of old, command-line
    style programs; nevertheless, we decided that adding a very
    simple feature to allow fast running of a program wouldn't
    be a problem.

    We considered several ideas for allowing arguments,
    including a popup box. This approach was deemed too clumsy,
    however, since we wanted to keep the "run" feature fast and
    simple. I figure you may as well type "java ClassName" first.

    My recommendation to this year's DrJava people -- if you
    implement this, perhaps leave the current feature alone, but
    add another option to, say, "Run Document's Main Method
    with arguments..." or something, since the only reason I
    personally ever use to run feature is to run a very simple
    test program that doesn't require input, and I think adding
    an extra step in the use of this feature would invalidate
    its usefulness to me.

    Finally, I'm reclassifying this as a feature request. It's
    not a bug, though the request for documentation is a
    reasonable one.

     
  • Charles Reis

    Charles Reis - 2004-05-28

    Logged In: YES
    user_id=429731

    I agree with Neal-- I don't think a pop up dialog is
    appropriate (no intuitive connection between the objects in
    the Interactions Pane that are available), and the "java
    Classname args" technique is by far the preferred approach.

    I would hesitate adding a new menu item as well, and I'd
    recommend documenting that the feature is merely a shortcut
    for the common case, not intended to be general purpose.

     
  • Neal Horowitz

    Neal Horowitz - 2004-06-01
    • priority: 5 --> 2