Hello there. I am trying to learn Java on Windows. I've
been developing C/C++ code on Unix. I figure netbeans
would shield me from most of Unix-to-Windows growing pains.
Anyways, I am trying to do something as simple as get input
from the user: System.in.read();
When running this program, this seems to make the program hang.
I figure it's because the program is waiting for user input.
How do I give that user input within the NetBeans development
environment?
I've tried to venture out into the DOS world to run the program,
but I am running into environmental issues like NoClassDefFound.
I can't find the DOS equivalent of the following:
which java (or whatever command)
env
setenv JAVA_HOME blah
Anyways, thanks for your time.
Jorge Cecílio - 12 Jan 2005 09:17 GMT
Try:
System.out.println(String); or
System.out.print(String);
(The String concatenation operator is "+")
To set DOS environment:
set var=value or
set var=%var%;value
To view DOS environment values:
echo %var%
If you're starting to learn JAVA, I suggest you take a look at
(excellent!) Sun's tutorial:
http://java.sun.com/docs/books/tutorial/reallybigindex.html
(you may want to start from the beginning:
http://java.sun.com/docs/books/tutorial/reallybigindex.html#getStarted)
Hope this helps,
JC
Jorge Cecílio - 12 Jan 2005 09:24 GMT
Sorry, I gave you wrong commands: those
System.out.println(String); or
System.out.print(String);
are to print out!
To input data, perhaps you should take a look at a GUI's library such
as Swing (See Sun's tutorial)
JC