Results 1 to 7 of 7
  1. #1
    dou2abou is offline Member
    Join Date
    Sep 2013
    Location
    Lebanon
    Posts
    2
    Rep Power
    0

    Default Comprehensive - Why compile then execute?

    I have been asked by my instructor to do a small research and find out why a Java program, has to be Compiled, then executed instead of having both actions done simultaneously. Can anyone answer or refer me to a trusted source?

    Thank you in advance

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,044
    Rep Power
    20

    Default Re: Comprehensive - Why compile then execute?

    The language spec?
    Possibly bits in the JVM spec might help as well (on the same page).

    What they should point out is that java is compiled, and then compiled again while being run in the JVM.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    dou2abou is offline Member
    Join Date
    Sep 2013
    Location
    Lebanon
    Posts
    2
    Rep Power
    0

    Default Re: Comprehensive - Why compile then execute?

    The way my doctor explained it is that Java is a platform, meaning that when you compile without execution, any remote person with access to that program can run/execute it without the need or use of your machine

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,050
    Rep Power
    6

    Default Re: Comprehensive - Why compile then execute?

    That has nothing to do with it; that person with remote access can also run the compiler. And if you have only class binaries you can decompile them, or simply investigate the well-known byte code to investigate what the application does.

    Nothing is strictly necessary; if you look at Ruby (which I consider to be the scripted counterpart of Java), the stuff is compiled on demand and you basically "run" the source files. Java was simply designed the way it is, over a decade ago. Back then it had great performance benefits to do so, nowadays not so much anymore.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    jmohandos304 is offline Member
    Join Date
    Apr 2014
    Posts
    90
    Rep Power
    0

    Default Re: Comprehensive - Why compile then execute?

    Sorry for invoking an old thread. What is class binaries? I searched google but it was of no use. How come you use so many high funda words? How many years of experience you have?

  6. #6
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,656
    Rep Power
    5

    Default Re: Comprehensive - Why compile then execute?

    Quote Originally Posted by jmohandos304 View Post
    What is class binaries?
    Compiled class source files. Probably any file that ends in a .class. Those files contain java byte code.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,050
    Rep Power
    6

    Default Re: Comprehensive - Why compile then execute?

    Quote Originally Posted by jim829 View Post
    Compiled class source files. Probably any file that ends in a .class. Those files contain java byte code.

    Regards,
    Jim
    Lies. Its this:

    Java Code:
    public class binaries {
    
    }
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 11
    Last Post: 02-08-2010, 12:15 AM
  2. Jcreator Compile/Execute option
    By airjohn6 in forum New To Java
    Replies: 7
    Last Post: 01-12-2010, 12:59 AM
  3. Compile/Execute code in Java app
    By Doctor Cactus in forum New To Java
    Replies: 5
    Last Post: 12-16-2008, 09:58 AM
  4. SWT DND (Drag and Drop) comprehensive Example
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 04:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •