Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Does running a jar require only JRE or complete JDK?

 
Ranch Foreman
Posts: 1766
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JDK has compiler and interpretor.
JRE is the interpretor part.
Running a jar does not involve compilation.
Does running a jar require only JRE ?
Thanks
 
Ranch Hand
Posts: 95
1
VI Editor Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, JRE is sufficient to run runnable JAR as you run it with 'java' command and that is part of JRE.
 
Saloon Keeper
Posts: 22634
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The one exception is with certain products like Tomcat. Historically, when you referenced a JSP in a JEE webapp, Tomcat would look in its cache for executable JSP code and if it didn't find it, it would fetch the JSP source, translate it to Java code (using a resource called JaSPer), then use "javac" to compile the Java code and create the executable JSP. Since javac comes with the JDK, but not the JRE, a JDK was required to run Tomcat.

Efforts have been made over the years to eliminate the need for javac, but I don't recall if they've finally succeeded.
 
Marshal
Posts: 70602
287
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't get the JRE on its own any more, only a JDK. Or it may be possible to send out the code as a .jar containing the JRE modules you need.
 
Monica Shiralkar
Ranch Foreman
Posts: 1766
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:You can't get the JRE on its own any more, only a JDK. Or it may be possible to send out the code as a .jar containing the JRE modules you need.



Thanks. I checked, separate JRE was discontinued from Java 11.

Regarding sending the code as .jar containining JRE modules to a machine  , in what way would someone run the jar without there being JRE in that machine ?
 
Tim Holloway
Saloon Keeper
Posts: 22634
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JRE was a subset of the JDK when they had separate identities. If you look in an old-time JDK directory you can see it - there's an extra bin subdirectory, for example.
 
Monica Shiralkar
Ranch Foreman
Posts: 1766
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
For my next trick, I'll need the help of a tiny ad ...
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic