Results 1 to 5 of 5

Thread: Java vs Groovy

  1. #1
    HoundBrother is offline Member
    Join Date
    Sep 2014
    Posts
    2
    Rep Power
    0

    Lightbulb Java vs Groovy

    Hi! So, I'm new to Java and I'm a bit confused.

    I recently found out about a language called Groovy, which is supposedly very similar syntactically to Java, but is slimmed down and simpler. Groovy is apparently also an 'interpreted' language, yet can be compiled to java bytecode and run on the JVM also.

    I found this: https://groovyconsole.appspot.com/ online groovy console which allows you to throw some groovy code at it, and it instantly provides the result.

    My question: Why can't this be done with Java? Is is just the compiled vs interpreted thing, or is there some deeper security issue, where Groovy is safer to run untrusted code because it's simpler?

    According to the creator of GroovyConsole, he didn't even sandbox the code, he just used Google App Engine and that provided enough security. Presumably that's not possible with Java?

    Thanks in advance for your help!

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Java vs Groovy

    Your question makes no sense. Groovy is only a language. It runs ON the Java Virtual Machine. In other words: Groovy IS Java.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    HoundBrother is offline Member
    Join Date
    Sep 2014
    Posts
    2
    Rep Power
    0

    Default Re: Java vs Groovy

    Quote Originally Posted by gimbal2 View Post
    Your question makes no sense. Groovy is only a language. It runs ON the Java Virtual Machine. In other words: Groovy IS Java.
    But Groovy can be run in the command line too, no? I assumed that was how it's able to be interpreted like Ruby or Python here.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Java vs Groovy

    Quote Originally Posted by gimbal2 View Post
    It runs ON the Java Virtual Machine. In other words: Groovy IS Java.
    I would think that depends on whether Java refers to just the language or the language and the JVM?
    If I have some CPU, say Intel, then that processor will execute instructions from many compiled
    languages, be it C, Pascal, Fortran, Cobol or whatever, as long as the compilers generate Intel instructions.
    Those are all different languages. I consider that the JVM is a virtual processor which executes byte code.
    So if those aforementioned compilers generate the same byte code, they may be run by the JVM but are not Java.

    Regards,
    Jim
    Last edited by jim829; 09-12-2014 at 02:22 AM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,143
    Rep Power
    15

Similar Threads

  1. Groovy Scripting and Java
    By aianta in forum New To Java
    Replies: 2
    Last Post: 08-24-2012, 04:25 PM
  2. Replies: 0
    Last Post: 01-12-2012, 11:46 AM
  3. Grails and Groovy
    By roamy in forum NetBeans
    Replies: 1
    Last Post: 12-10-2010, 07:43 AM
  4. Groovy For OpenOffice 0.2
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-15-2007, 05:49 PM
  5. Groovy For OpenOffice 0.1
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-10-2007, 02:29 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
  •