Attempt to reproduce Java Game sample

Story: Practice coding in Java by writing a gameTotal Replies: 0
Author Content
dba477

Dec 16, 2020
3:48 AM EDT
Original compilation is

javac src/Guess.java -d com/example/guess

[boris@sever33fedora JAVAGAME]$ javac src/Guess.java -d .

[boris@sever33fedora JAVAGAME]$ ls com/example/guess

Main.class

[boris@sever33fedora JAVAGAME]$ jar cfme Guess.jar Manifest.txt com.example.guess.Main com/example/guess/Main.class

[boris@sever33fedora JAVAGAME]$ ls -l

total 8

drwxrwxr-x. 3 boris boris 21 Dec 16 10:33 com

-rw-rw-r--. 1 boris boris 1426 Dec 16 10:45 Guess.jar

-rw-rw-r--. 1 boris boris 22 Dec 16 10:01 Manifest.txt

drwxrwxr-x. 2 boris boris 24 Dec 16 10:22 src

[boris@sever33fedora JAVAGAME]$ jar tvf Guess.jar

0 Wed Dec 16 10:45:16 MSK 2020 META-INF/

99 Wed Dec 16 10:45:16 MSK 2020 META-INF/MANIFEST.MF

1572 Wed Dec 16 10:43:40 MSK 2020 com/example/guess/Main.class

[boris@sever33fedora JAVAGAME]$ java -jar Guess.jar

number is 49

Guess a number between 1 and 100

48

Too low

Guess a number between 1 and 100

50

Too high

Guess a number between 1 and 100

49

That's right!

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!