Enabling User Input When Running Classes Inside JDeveloper

Let's suppose you wrote a piece of Java code that needs some user input - and you used something like

String text = stdin.readLine();

Now you want to run or debug it inside JDeveloper, but how do you get JDeveloper to prompt you for the input value?

Here is the "secret trick":

Go into the project properties and edit the current Run/Debug Configuration.
Under the tools settings node you'll see that the last item allows you to specify "Allow Program Input"

input1:

check this box and run your project.

Now when you hit the input request look at your log window - just below it you'll see a little input field ready for your input:


input2:

Comments:

Hi, I already know this method to take in program input, however when I want to input the end-of-file character (CTRL-C) in windows Jdeveloper refuses to accept any input. How can I input the EOF in Jdeveloper? Thanks.

Posted by Seyi Adebajo on July 07, 2008 at 03:10 AM PDT #

Now this is a blog post I have to agree with. Your views are quite good. I'll be sure to subscribe :-)

Posted by sore foot on September 15, 2008 at 04:52 AM PDT #

hey thanks for the userful info

Posted by kate on April 17, 2011 at 06:59 PM PDT #

thanks, you helped me in a lot of java tricks and java Problems that faces me specially when the problem in JDeveloper.

thanks again

Posted by Mohamed Shahpoup on August 23, 2011 at 09:45 AM PDT #

Thank you. This is and very good trick.

Posted by guest on December 01, 2011 at 01:28 AM PST #

Very useful, thanks.

Posted by guest on May 26, 2012 at 04:46 AM PDT #

Thanks for great info..

Posted by guest on August 03, 2012 at 04:28 AM PDT #

Thanks a lot for the great info

Posted by guest on July 10, 2013 at 08:51 PM PDT #

Hi, the trick is good but I recently installed jDeveloper 12c and although I did what you said above I still can not write in the input line. Once I enable "Allow user input" the input line appears but I can't write in it. I can not position the cursor inside it. Can you help?

Posted by guest on December 09, 2013 at 01:29 PM PST #

There is a bug in 12c that we are aware off.
See discussion here:
https://forums.oracle.com/message/11167674#11167674
Someone reported a workaround there:
"check autoscroll option > actions > log windows:

Posted by Shay on December 09, 2013 at 03:33 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today