• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Sybex 11 - Chapter 11-pg 480 (Modules)

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning all!

I am trying to practice some of the commands showed on the examples, specifically for the jar command that describes a module.



When I do this, the command-line shows (see attached image):

So, I don't understand what is the issue. I had the code from the repo, then rewrite it all over again, and still shows that message.

Does someone have an idea what could be the issue?
1.png
command-line output
command-line output
 
Saloon Keeper
Posts: 3877
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can suggest you to check what version of jar is used

Can you perhaps try

java -version
where jar

JAR.png
[Thumbnail for JAR.png]
 
Blad Baez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried what you suggested and I have this output (see image)

Mikalai Zaikin wrote:I can suggest you to check what version of jar is used

Can you perhaps try

java -version
where jar

1.png
[Thumbnail for 1.png]
 
Mikalai Zaikin
Saloon Keeper
Posts: 3877
43
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparently, you use JAR from Java 8 install -- it's higher than Java 11 in the second command output

So, I suggest you go and edit the %PATH% environment variable (this may break some other applications that rely on your machine on Java 8 by default), OR provide a full absolute path to JAR from v.11 location for a quick check

If you plan to practice further with Java 11 on this machine, maybe updating %PATH% is a better idea...
 
Marshal
Posts: 78698
374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mikalai Zaikin wrote:. . . this may break some other applications . . .

Would it break anything? Although some API was deprecated in Java9, I don't think anything was removed, so I wouldn't anticipate any problems.
 
Mikalai Zaikin
Saloon Keeper
Posts: 3877
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't be too careful these days (c) Hagrid
I personally got Swing PLAF problem when moved to Java 11 on Windows
 
Saloon Keeper
Posts: 15276
350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is not the wrong Java version. The screenshot clearly shows Java 11 being used.

The problem is that the command is just wrong. It even tells you what is wrong: one of -c -t -x or -u must be specified.

Besides that, an illegal option was provided: -d.
 
Mikalai Zaikin
Saloon Keeper
Posts: 3877
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before posting my answer I tried, and these jar options (-f -d) were ok (although I used Java 17 JDK)
 
Stephan van Hulst
Saloon Keeper
Posts: 15276
350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's my mistake, I saw that the java -version command ouput Java 11, so I assumed the same was true for the jar command.

Blad Baez, please run the following command: jar --version
 
Blad Baez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Mikalai Zaikin.

I just removed the 1.8 version from the PATH on the environment variables.
Now, the jar commands work as intended. I also can see the jar version, which is jar 11.0.16.1

Thank you again!
 
Mikalai Zaikin
Saloon Keeper
Posts: 3877
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds good!
Have fun ;-)
 
I'm doing laundry! Look how clean this tiny ad is:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic