Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java vs Groovy

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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: 'groovyconsole dot appconsole dot 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
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 120 Times in 104 Posts

    Default Re: Java vs Groovy

    As far as I know groovy code is translated into java byte-code before being interpreted, so everything possible with groovy should be possible with java too. Its just the different way to use it.

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java vs Groovy

    Quote Originally Posted by Cornix View Post
    As far as I know groovy code is translated into java byte-code before being interpreted, so everything possible with groovy should be possible with java too. Its just the different way to use it.
    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
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 633 Times in 540 Posts

    Default Re: Java vs Groovy

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/92621-java-vs-groovy.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5

    Default Re: Java vs Groovy

    Java and Groovy both are JDK based languages . Java is strongly and statically typed language whereas Groovy is dynamically and optionally typed language .
    The best things about groovy is that Since it extends JDK , it accepts the java code .

Similar Threads

  1. how to create groovy client? getting an error, below.
    By game06 in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: June 30th, 2014, 07:12 AM
  2. how to write a function *method* in Java to reverse an Array using Groovy?
    By Cyclist in forum Other Programming Languages
    Replies: 7
    Last Post: October 17th, 2012, 06:20 PM
  3. Replies: 1
    Last Post: January 12th, 2012, 08:14 AM