• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JRE and compiler

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A file that contains bytecode is given (I mean a xyz.class file is given)

Do I need Runtime Environment and Compiler both, or one of them or none of them to run that file?
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you think and why? Try to explain it. You'll learn more that way and we will correct you.
 
Ranch Hand
Posts: 491
23
Eclipse IDE Firefox Browser Spring VI Editor AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi sanket,
If you have the binary file(with *.class* extension) then you can run it using java runtime environment(JRE) only.Actually java development kit(JDK) comes with both the development tools(javac-compiler,javap,javadoc...etc) and the java RunTime environment.if you will explore the bin directory in "jdk" folder and as  well as in "jre" folder you will see they both have the *java* tool(which runs the binary file).
I have my folder path for java = c:\programfiles\java
java has 2 folders the "jdk" and the "jre".initially i have my path variable as "PATH = c:\programfiles\java\jdk\bin" but accordingly with your question i set it to "PATH = c:\programfiles\java\jre\bin".you can note the difference in the latter one if you will simply type "javac",press enter,you will get a message-javac is not recognized as a...
one more thing make it sure that the binary file must have been compiled on the version as it is of the jre(or prior to the version of this jre).i mean don't try to run code compiled by javac version 8 on the jre 7.
 
Sanket JainNy
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I would need only JRE as code is already compiled.

Compiler converts .java file into .class (ByteCode) file. So compilers work is over. Now JRE should do the rest.
 
praveen kumaar
Ranch Hand
Posts: 491
23
Eclipse IDE Firefox Browser Spring VI Editor AngularJS Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sanket Jaincoding wrote:I think I would need only JRE as code is already compiled.

Compiler converts .java file into .class (ByteCode) file. So compilers work is over. Now JRE should do the rest.


why are you still thinking.why don't you try it live!.
In my opinion that can be the best answer you would get for you(practical makes things easy).

Kind Regards,
Praveen.
reply
    Bookmark Topic Watch Topic
  • New Topic