Results 1 to 4 of 4
  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
    11,450
    Rep Power
    19

    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.

  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
    3,083
    Rep Power
    4

    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

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. 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
  •