Netbeans Upgrade Problem

T

tabletcorry

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
 
H

hilz

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
 
R

Roland

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_/ /__/
/ \ /_/ / \
 
T

Tabletcorry

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

Issue #47708
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top