Netbeans Upgrade Problem

Discussion in 'Java' started by tabletcorry@gmail.com, Jan 26, 2005.

  1. Guest

    In upgrading from Netbeans 3.6 to 4.0 some code that I had already
    written for my Computer Science class became disfunctional.

    The code is

    //This is a program to determine whether or not a user entered year is
    a leap year on the Gregorian Calender
    package GPP3;

    import cs1.Keyboard;
    public class GPP3_03 {

    public static void main(String[] args) {
    final int LEAP_NUM=4,LEAPCK1=100,LEAPCK2=400,GREGCK=1583;
    int year, id=0;

    System.out.print("Please enter the Year to be checked: ");
    year=Keyboard.readInt();

    while (year != 0) {
    if (year%LEAP_NUM==0)
    id=1;
    if (year%LEAPCK1==0){
    id=0;
    if (year%LEAPCK2==0)
    id=1;
    }
    if (year<GREGCK)
    id=3;

    if (id==1)
    System.out.println("The year is a leap year");
    else
    if (id==0)
    System.out.println("The year is not a leap year");
    else
    System.out.println("The Gregorian calender was not
    created by that time");

    System.out.print("Please enter the Year to be checked (0 to
    exit): ");
    year=Keyboard.readInt();

    }
    }

    }


    The cs1 class is used to given to us by the writers of the book and is
    used to get input from the user.
    THe cs1 code is here

    http://duke.csc.villanova.edu/jss/downloads/Keyboard.java


    For some reason when the code is run in netbeans it returns

    Error reading int data, MIN_VALUE value returned.

    which it never did in version 3.6

    While I can always go back to 3.6, the newer version has sever great
    features that I would like to use

    Any help would be greatly appreciated
     
    , Jan 26, 2005
    #1
    1. Advertising

  2. hilz Guest

    <> wrote in message
    news:...
    > In upgrading from Netbeans 3.6 to 4.0 some code that I had already
    > written for my Computer Science class became disfunctional.
    >


    A quick look at your code, and the provided "Keyboad" class makes me beleive
    the problem has nothing to do with the version of NB you're running.
    See what you are doing differently when you upgraded.
    Have you tried to run it from the command line and see if it works there?

    good luck

    hilz
     
    hilz, Jan 26, 2005
    #2
    1. Advertising

  3. Roland Guest

    On 26-1-2005 6:51, wrote:

    > In upgrading from Netbeans 3.6 to 4.0 some code that I had already
    > written for my Computer Science class became disfunctional.
    >
    > The code is
    >
    > //This is a program to determine whether or not a user entered year is
    > a leap year on the Gregorian Calender
    > package GPP3;
    >
    > import cs1.Keyboard;
    > public class GPP3_03 {
    >
    > public static void main(String[] args) {
    > final int LEAP_NUM=4,LEAPCK1=100,LEAPCK2=400,GREGCK=1583;
    > int year, id=0;
    >
    > System.out.print("Please enter the Year to be checked: ");
    > year=Keyboard.readInt();
    >
    > while (year != 0) {
    > if (year%LEAP_NUM==0)
    > id=1;
    > if (year%LEAPCK1==0){
    > id=0;
    > if (year%LEAPCK2==0)
    > id=1;
    > }
    > if (year<GREGCK)
    > id=3;
    >
    > if (id==1)
    > System.out.println("The year is a leap year");
    > else
    > if (id==0)
    > System.out.println("The year is not a leap year");
    > else
    > System.out.println("The Gregorian calender was not
    > created by that time");
    >
    > System.out.print("Please enter the Year to be checked (0 to
    > exit): ");
    > year=Keyboard.readInt();
    >
    > }
    > }
    >
    > }
    >
    >
    > The cs1 class is used to given to us by the writers of the book and is
    > used to get input from the user.
    > THe cs1 code is here
    >
    > http://duke.csc.villanova.edu/jss/downloads/Keyboard.java
    >
    >
    > For some reason when the code is run in netbeans it returns
    >
    > Error reading int data, MIN_VALUE value returned.
    >
    > which it never did in version 3.6
    >
    > While I can always go back to 3.6, the newer version has sever great
    > features that I would like to use
    >
    > Any help would be greatly appreciated
    >

    Just tried it in Eclipse. And it runs fine (though incorrect: 1999 is
    not a leap year ;-) ).
    Also tried it in NB4. And it enters an infinite loop (with the error
    message you cited). This is because it is unable to take input from the
    keyboard input stream (its an empty stream like /dev/null ). I'm not up
    to speed with Netbeans (normally use Eclipse). The help on "Output
    Window" mentions the following:
    <quote>
    When you run a program that requires user input, a new tab appears in
    the Output window. This tab includes a cursor. You can enter information
    in the Output window as you would on a command line.
    </quote>
    However this input tab does not appear. Probably with the new build
    system of NB4 (using Ant), input to commandline programs has become
    difficult, or maybe impossible.

    Someone with experience in NB4 maybe knows how to enter keyboard input
    for a command line program. Otherwise, if Netbeans has support forums
    (undoubtly they have), you might want to ask there.
    --
    Regards,

    Roland de Ruiter
    ___ ___
    /__/ w_/ /__/
    / \ /_/ / \
     
    Roland, Jan 26, 2005
    #3
  4. Tabletcorry Guest

    Problem addressed (and possibly solved) in the bugs section of
    netbeans.org

    Issue #47708
     
    Tabletcorry, Feb 2, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pimousse
    Replies:
    2
    Views:
    3,660
    Roedy Green
    Apr 21, 2004
  2. Ilias Lazaridis
    Replies:
    0
    Views:
    923
    Ilias Lazaridis
    Dec 12, 2004
  3. Thomas G. Marshall
    Replies:
    2
    Views:
    841
    Thomas G. Marshall
    Oct 16, 2006
  4. Replies:
    2
    Views:
    486
    Juha Laiho
    Dec 28, 2006
  5. Replies:
    5
    Views:
    302
    Dr.Ruud
    Jul 5, 2006
Loading...

Share This Page