Win a copy of Fixing your Scrum this week in the Agile forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

OCP Java SE 11 Programmer II STUDY GUIDE (Appendix A The Upgrade Exam) Error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Please I am currently reading the following book : OCP Java SE 11 Programmer II STUDY GUIDE of Scott Selikoff and Jeanne Boyarsky.
I compiled and executed the first module: "zoo.animal.feeding" (Appendix A The Upgrade Exam) without any problem but  a have an error when trying to generate a jar package of that module by executing this command.
jar -cvf mods/zoo.animal.feeding.jar -C feeding/ ..

First ligne of error trace : java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 57.0.

Thanks for your help.
zoo.animal.feeding.jar-error.PNG
snapshot of the error
snapshot of the error
 
Bartender
Posts: 3716
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can guess you compiled .java with Java 13 (Java SE 13 = 57) and now you use jar utility from Java 11 or <13.

You can try these commands to investigate:

where java
where javac
where jar
javac -version
java -version
 
Mikalai Zaikin
Bartender
Posts: 3716
38
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general, the error happened because in Java you may not run code (java) with Java version smaller than version of Java used for compilation (javac). The opposite is allowed. I.e.

compile with Java 13, run with Java 11 => fail
compile with Java 11, run with Java 13 => success

P.S. Welcome to CodeRanch ! 8-)
 
Joseph Tamo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right @Mikalai Zaikin
Thank you so much!
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic