J2SE 1.5.0 Installation / Command-line setting

A

Academic Q

Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
Java; Java -version shows in shell window; little "hello world"
program written in notepad compiled and ran under shell window and
netbeans. I love Java.

After 2nd class, students required to use command-line code
(Integer.parseInt(args)) to form a program. The code below ran and
could pop up little window to ask user number inputs. With home
machine, the same code was compiled successfully with 0-error, but NO
little pop-up window shown to ask user inputs, ends up nothing happen
when let it run under both shell window and netbeans. fraustrated that
I am stucked in just 2nd class.

Anything wrong with installation or Command-line setting? I
reinstalled J2SE1.5.0, still get the same result.

public static void main(String[] args) {
int[] numbers = new int[args.length];

for (int i = 0; i < args.length ; i++) {
numbers = Integer.parseInt(args);
}

for (int i = 0; i < args.length ; i++) {
System.out.println(numbers);
}
}

Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
Environment 5.0 in C:\jdk1.5.0_01 directory (not
C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
jdk directory contains bin, demo, docs, include, jre, lib, sample, src
folders.

Thank you much!
Ching Shih
 
K

kjc

Academic said:
Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
Java; Java -version shows in shell window; little "hello world"
program written in notepad compiled and ran under shell window and
netbeans. I love Java.

After 2nd class, students required to use command-line code
(Integer.parseInt(args)) to form a program. The code below ran and
could pop up little window to ask user number inputs. With home
machine, the same code was compiled successfully with 0-error, but NO
little pop-up window shown to ask user inputs, ends up nothing happen
when let it run under both shell window and netbeans. fraustrated that
I am stucked in just 2nd class.

Anything wrong with installation or Command-line setting? I
reinstalled J2SE1.5.0, still get the same result.

public static void main(String[] args) {
int[] numbers = new int[args.length];

for (int i = 0; i < args.length ; i++) {
numbers = Integer.parseInt(args);
}

for (int i = 0; i < args.length ; i++) {
System.out.println(numbers);
}
}

Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
Environment 5.0 in C:\jdk1.5.0_01 directory (not
C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
jdk directory contains bin, demo, docs, include, jre, lib, sample, src
folders.

Thank you much!
Ching Shih

I don't see how this code could prompt for anything.
You must be missing some code.
Where is the code to do input ??
 
S

Steve W. Jackson

:Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
:Java; Java -version shows in shell window; little "hello world"
:program written in notepad compiled and ran under shell window and
:netbeans. I love Java.
:
:After 2nd class, students required to use command-line code
:(Integer.parseInt(args)) to form a program. The code below ran and
:could pop up little window to ask user number inputs. With home
:machine, the same code was compiled successfully with 0-error, but NO
:little pop-up window shown to ask user inputs, ends up nothing happen
:when let it run under both shell window and netbeans. fraustrated that
:I am stucked in just 2nd class.
:
:Anything wrong with installation or Command-line setting? I
:reinstalled J2SE1.5.0, still get the same result.
:
: public static void main(String[] args) {
: int[] numbers = new int[args.length];
:
: for (int i = 0; i < args.length ; i++) {
: numbers = Integer.parseInt(args);
: }
:
: for (int i = 0; i < args.length ; i++) {
: System.out.println(numbers);
: }
: }
:
:Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
:Environment 5.0 in C:\jdk1.5.0_01 directory (not
:C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
:jdk directory contains bin, demo, docs, include, jre, lib, sample, src
:folders.
:
:Thank you much!
:Ching Shih


There's no code in what you've shown that pops up any windows. That
code only handles whatever arguments you put on the command line (like
"java MyClass 1 2 3 4 5" for instance). And it has no error handling,
which you will probably cover in a future class.

= Steve =
 
R

Roland

Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
Java; Java -version shows in shell window; little "hello world"
program written in notepad compiled and ran under shell window and
netbeans. I love Java.

After 2nd class, students required to use command-line code
(Integer.parseInt(args)) to form a program. The code below ran and
could pop up little window to ask user number inputs. With home
machine, the same code was compiled successfully with 0-error, but NO
little pop-up window shown to ask user inputs, ends up nothing happen
when let it run under both shell window and netbeans. fraustrated that
I am stucked in just 2nd class.

Anything wrong with installation or Command-line setting? I
reinstalled J2SE1.5.0, still get the same result.

public static void main(String[] args) {
int[] numbers = new int[args.length];

for (int i = 0; i < args.length ; i++) {
numbers = Integer.parseInt(args);
}

for (int i = 0; i < args.length ; i++) {
System.out.println(numbers);
}
}

Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
Environment 5.0 in C:\jdk1.5.0_01 directory (not
C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
jdk directory contains bin, demo, docs, include, jre, lib, sample, src
folders.

Thank you much!
Ching Shih


As other posters noted, this program does not popup a window asking for
input. Maybe in your student class environment you launch the Java
program differently. Especially if you have Mac OS, it will popup a
window where you can specify the arguments to the Java program. It looks
like this
<http://java.sun.com/docs/books/tutorial/getStarted/cupojava/mac.html#2c>.

In Windows / Unix environment you have to specify the arguments on the
command line, something like:

C:>java YourProg 345 6768 910112



HTH,
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
S

Steve W. Jackson

Roland said:
:On 25-1-2005 18:51, Academic Q wrote:
:
:> Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
:> Java; Java -version shows in shell window; little "hello world"
:> program written in notepad compiled and ran under shell window and
:> netbeans. I love Java.
:>
:> After 2nd class, students required to use command-line code
:> (Integer.parseInt(args)) to form a program. The code below ran and
:> could pop up little window to ask user number inputs. With home
:> machine, the same code was compiled successfully with 0-error, but NO
:> little pop-up window shown to ask user inputs, ends up nothing happen
:> when let it run under both shell window and netbeans. fraustrated that
:> I am stucked in just 2nd class.
:>
:> Anything wrong with installation or Command-line setting? I
:> reinstalled J2SE1.5.0, still get the same result.
:>
:> public static void main(String[] args) {
:> int[] numbers = new int[args.length];
:>
:> for (int i = 0; i < args.length ; i++) {
:> numbers = Integer.parseInt(args);
:> }
:>
:> for (int i = 0; i < args.length ; i++) {
:> System.out.println(numbers);
:> }
:> }
:>
:> Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
:> Environment 5.0 in C:\jdk1.5.0_01 directory (not
:> C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
:> jdk directory contains bin, demo, docs, include, jre, lib, sample, src
:> folders.
:>
:> Thank you much!
:> Ching Shih
:
:As other posters noted, this program does not popup a window asking for
:input. Maybe in your student class environment you launch the Java
:program differently. Especially if you have Mac OS, it will popup a
:window where you can specify the arguments to the Java program. It looks
:like this
:<http://java.sun.com/docs/books/tutorial/getStarted/cupojava/mac.html#2c>.
:
:In Windows / Unix environment you have to specify the arguments on the
:command line, something like:
:
:C:>java YourProg 345 6768 910112
:
:
:
:HTH,


You should totally forget the existence of that referenced page for Mac
users. That applies only to the older Mac system, not to Mac OS X.
Those systems didn't support Swing at all and only supported Java up to
1.1.8.

All Macs with OS X installed contain at least Java 1.3. The latest
available Java version is 1.4.2. And it's pretty much Unix-like in how
it works.

= Steve =
 
?

=?ISO-8859-1?Q?Johan_K=FCtt?=

I don't see how this code could prompt for anything.
You must be missing some code.
Where is the code to do input ??

nope, I think the code is correct. But I agree, that this code can't
produce any kind of pop-up window.


to kjc:
This program takes the input directly from command line. It will read
the arguments, given after the program name, separated by spaces, and
assign them to the array args[].

for example:
let's say the program is called InputTest
and we enter a command line like this: java InputTest 1 2 3
the program will get 3 String arguments ("1", "2", "3"), that are
assigned to args[0], args[1] and args[2] respectively


hope this helps

johan

Academic said:
Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
Java; Java -version shows in shell window; little "hello world"
program written in notepad compiled and ran under shell window and
netbeans. I love Java.

After 2nd class, students required to use command-line code
(Integer.parseInt(args)) to form a program. The code below ran and
could pop up little window to ask user number inputs. With home
machine, the same code was compiled successfully with 0-error, but NO
little pop-up window shown to ask user inputs, ends up nothing happen
when let it run under both shell window and netbeans. fraustrated that
I am stucked in just 2nd class.

Anything wrong with installation or Command-line setting? I
reinstalled J2SE1.5.0, still get the same result.

public static void main(String[] args) {
int[] numbers = new int[args.length];

for (int i = 0; i < args.length ; i++) {
numbers = Integer.parseInt(args);
}

for (int i = 0; i < args.length ; i++) {
System.out.println(numbers);
}
}

Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
Environment 5.0 in C:\jdk1.5.0_01 directory (not
C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
jdk directory contains bin, demo, docs, include, jre, lib, sample, src
folders.

Thank you much!
Ching Shih
 
K

kjc

Johan said:
I don't see how this code could prompt for anything.
You must be missing some code.
Where is the code to do input ??

nope, I think the code is correct. But I agree, that this code can't
produce any kind of pop-up window.


to kjc:
This program takes the input directly from command line. It will read
the arguments, given after the program name, separated by spaces, and
assign them to the array args[].

for example:
let's say the program is called InputTest
and we enter a command line like this: java InputTest 1 2 3
the program will get 3 String arguments ("1", "2", "3"), that are
assigned to args[0], args[1] and args[2] respectively


hope this helps

johan

Academic said:
Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
Java; Java -version shows in shell window; little "hello world"
program written in notepad compiled and ran under shell window and
netbeans. I love Java.

After 2nd class, students required to use command-line code
(Integer.parseInt(args)) to form a program. The code below ran and
could pop up little window to ask user number inputs. With home
machine, the same code was compiled successfully with 0-error, but NO
little pop-up window shown to ask user inputs, ends up nothing happen
when let it run under both shell window and netbeans. fraustrated that
I am stucked in just 2nd class.

Anything wrong with installation or Command-line setting? I
reinstalled J2SE1.5.0, still get the same result.

public static void main(String[] args) {
int[] numbers = new int[args.length];

for (int i = 0; i < args.length ; i++) {
numbers = Integer.parseInt(args);
}

for (int i = 0; i < args.length ; i++) {
System.out.println(numbers);
}
}

Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
Environment 5.0 in C:\jdk1.5.0_01 directory (not
C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
jdk directory contains bin, demo, docs, include, jre, lib, sample, src
folders.

Thank you much!
Ching Shih

Yeah,Yeah, I know all of the verbage you write is true, known it since,
1.0.1, but the code that the OP posted above does NOT, I REPEAT, NOT
prompt anyone for any input. Period.
 
A

Aquila Deus

Steve said:
Roland said:
:On 25-1-2005 18:51, Academic Q wrote:
:
:> Seems ok installed J2SE 1.5.0 (Windows XP) at home after 1st class of
:> Java; Java -version shows in shell window; little "hello world"
:> program written in notepad compiled and ran under shell window and
:> netbeans. I love Java.
:>
:> After 2nd class, students required to use command-line code
:> (Integer.parseInt(args)) to form a program. The code below ran and
:> could pop up little window to ask user number inputs. With home
:> machine, the same code was compiled successfully with 0-error, but NO
:> little pop-up window shown to ask user inputs, ends up nothing happen
:> when let it run under both shell window and netbeans. fraustrated that
:> I am stucked in just 2nd class.
:>
:> Anything wrong with installation or Command-line setting? I
:> reinstalled J2SE1.5.0, still get the same result.
:>
:> public static void main(String[] args) {
:> int[] numbers = new int[args.length];
:>
:> for (int i = 0; i < args.length ; i++) {
:> numbers = Integer.parseInt(args);
:> }
:>
:> for (int i = 0; i < args.length ; i++) {
:> System.out.println(numbers);
:> }
:> }
:>
:> Followed the book, I set J2SE Development Kit 5.0 and J2SE Runtime
:> Environment 5.0 in C:\jdk1.5.0_01 directory (not
:> C:\program\jdk1.5.0_01) and C:\jre1.5.0_01 directory separately. That
:> jdk directory contains bin, demo, docs, include, jre, lib, sample, src
:> folders.
:>
:> Thank you much!
:> Ching Shih
:
:As other posters noted, this program does not popup a window asking for
:input. Maybe in your student class environment you launch the Java
:program differently. Especially if you have Mac OS, it will popup a
:window where you can specify the arguments to the Java program. It looks
:like this


: said:
:
:In Windows / Unix environment you have to specify the arguments on the
:command line, something like:
:
:C:>java YourProg 345 6768 910112
:
:
:
:HTH,

You should totally forget the existence of that referenced page for Mac
users. That applies only to the older Mac system, not to Mac OS X.
Those systems didn't support Swing at all and only supported Java up to
1.1.8.

All Macs with OS X installed contain at least Java 1.3. The latest
available Java version is 1.4.2. And it's pretty much Unix-like in how
it works.


Ah, but the window shows "/dev/null"... old mac has it?? does it have
/dev/sound and /dev/hda... too?
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top