Here, let me put some Javascript in your Java



  • Project Nashorn by Oracle

    Nashorn is a JavaScript engine implemented fully in Java on the JVM and will be available with
    JDK 8.

    This Project intends
    to enable Java developers embedding of JavaScript in Java
    applications




  • Wasn't Dojo that...? Did they rename or, or start a new one from scratch?



  •  YO DAWG, IT'S JAVASCRIPT IN JAVA, NOT JAVA IN JAVASCRIPT.



  •  @blakeyrat said:

    Wasn't Dojo that...? Did they rename or, or start a new one from scratch?
    Information is sketchy but this appears to be a new one . . . sort of.  According to Wikipedia:
    The project was announced first at the JVM language summit in July 2011.  Nashorn is the German translation of 'rhinoceros', a play on words on Rhino, the name of a JavaScript engine implemented in Java by Mozilla Foundation.



  • @derari said:

     YO DAWG, IT'S JAVASCRIPT IN JAVA, NOT JAVA IN JAVASCRIPT.

    It's chicken in a duck in a turkey

     



  •  It has finally come home.



  • Is there any sensible use-case for writing javascript in java? Between Jython, JRuby, Clojure, Scala and Groovy, I'd say practically every kind of language you want to code in on the JVM is covered. And it's not like anybody has large swathes of business-logic implemented in javascript running server-side in node.js and just wakes up each day with a sigh, thinking "I really love writing javascript server-side, but having to write my own js database drivers is such a pain. I just wish I could use all these java libraries, but without writing java or python or ruby or clojure or groovy or scala or really anything other than javascript."... Right?



  • @dhromed said:

     It has finally come home.

     

    A common misconception. Javascript doesn't actually share anything with Java and wasn't even called Javascript to begin with.

     



  • @Mo6eB said:

    Javascript doesn't actually share anything with Java and wasn't even called Javascript to begin with.
     

    I was under the impression Brendan Eich looked at Java when he was developing LiveScript and stole was inspired by some of its ideals.

    There's certainly a lot of overlap - but then since both sprang from C originally, they'd exhibit the same genetic traits.



  • @Mo6eB said:

    @dhromed said:

     It has finally come home.

     

    A common misconception. Javascript doesn't actually share anything with Java and wasn't even called Javascript to begin with.

    I am aware of this fact.




  • @Cassidy said:

    I was under the impression Brendan Eich looked at Java when he was developing LiveScript and stole was inspired by some of its ideals.

    Iirc the name JavaScript came about as a trade-off for Sun's support of Java in Netscape.



  • There is a good application for JS in Java, namely scripting. For larger applications, it's nice to be able to allow users to program the system, and JavaScript is a language that's well-known by many programmers, and isn't that hard to teach to business users. It isn't intended for the original application developers to use it, only the customers who don't have the ability to change the host application themselves, or don't want to expend the effort required to do so.



  • @Ragnax said:

    @Cassidy said:
    I was under the impression Brendan Eich looked at Java when he was developing LiveScript and stole was inspired by some of its ideals.

    Iirc the name JavaScript came about as a trade-off for Sun's support of Java in Netscape.

    [quote user="W3C.org"]JavaScript was created in May 1995 by Brendan Eich, then working at Netscape and now of Mozilla. JavaScript was not always known as JavaScript: the original name was Mocha, a name chosen by Marc Andreessen,
    founder of Netscape. In September of 1995 the name was changed to
    LiveScript, then in December of the same year, upon receiving a
    trademark license from Sun, the name JavaScript was adopted. This was
    somewhat of a marketing move at the time, with Java being very popular
    around then.[/quote]



  • @blakeyrat said:

    Wasn't Dojo that...? Did they rename or, or start a new one from scratch?

    The Dojo that I know is a javascript library that sits somewhere between JQuery and YUI in that it provides DOM manipulation and querying, as well as a set of widgets.



  • @lushr said:

    There is a good application for JS in Java, namely scripting. For larger applications, it's nice to be able to allow users to program the system, and JavaScript is a language that's well-known by many programmers, and isn't that hard to teach to business users. It isn't intended for the original application developers to use it, only the customers who don't have the ability to change the host application themselves, or don't want to expend the effort required to do so.

    Exactly. It's the same reason Lua has gained any traction in game development. You can script your level logic in a lightweight language, on a lightweight interpreter (less than 1MB, as I recall) and the scripts can be embedded into the level files themselves without needing to be introspected by the engine itself. Not to mention its easier to sandbox so people don't get the bright idea to write custom levels that use system IO to delete the entire file system.



  • @Soviut said:

    Not to mention its easier to sandbox so people don't get the bright idea to write custom levels that use system IO to delete the entire file system.

    I recall a space invaders clone for Mac that did that. If you destroyed an enemy ship, it would delete a random file from your home folder. If you lost the game, it deleted itself and exited.


  • Winner of the 2016 Presidential Election

    That'd be awesome if the invaders were each the icons of your files and it just played in attract mode.

    Like the silly viruses in Hackers.



  • @joe.edwards said:

    That'd be awesome if the invaders were each the icons of your files and it just played in attract mode.

    Like the silly viruses in Hackers.

    File gambling. Hmm.



  • @lushr said:

    There is a good application for JS in Java, namely scripting
    Well, yeah, it's called JavaSCRIPT.

    Reading through the history of Javascript it seems odd -- Javascript was created in the mid-90's as a scripting language for use with Java and Netscape had a "Project Rhino" that was a Javascript engine written in Java.  And now, about 18 years later, Oracle, who owns Sun and Java, is announcing a Javascript engine written in Java.

    Well, you know what they say, "Everything old is new again".



  • @Ben L. said:

    @Soviut said:
    Not to mention its easier to sandbox so people don't get the bright idea to write custom levels that use system IO to delete the entire file system.

    I recall a space invaders clone for Mac that did that. If you destroyed an enemy ship, it would delete a random file from your home folder. If you lost the game, it deleted itself and exited.
    It was a concept art project called 'lose/lose'.

    The high score is only 412.  Why not see if you can beat it?




  • Is there a Java VM written in JavaScript yet?



  • @El_Heffe said:

    Nashorn is the German translation of 'rhinoceros'
    Conflicting information!

    Unless there are more German words for the animal, in which case carry on.



  • @Zecc said:

    @El_Heffe said:

    Nashorn is the German translation of 'rhinoceros'
    Conflicting information!

    Unless there are more German words for the animal, in which case carry on.

    Rhinos != hippos. Unless you're trying to make some other subtle point that slipped past me.


  • Discourse touched me in a no-no place

    @zelmak said:

    Is there a Java VM written in JavaScript yet?
    Idiocy. More idiocy. It doesn't stop there.



  • @PJH said:

    @zelmak said:
    Is there a Java VM written in JavaScript yet?
    Idiocy. More idiocy. It doesn't stop there.

    As someone who puts languages inside other languages that are compiled by yet other languages, that's insane. There might be some cases where it could be useful to me, though...



  • @PJH said:

    @zelmak said:
    Is there a Java VM written in JavaScript yet?
    Idiocy. More idiocy. It doesn't stop there.

    jsJVM allows execution of Java Bytecode within a web browser without the need for any client side dependancies. [sic]

    This brings some interesting questions to light. IIRC, (in theory) Java has certain security features that prevent you from running potentially malicious code online (e.g., using the JNI to call C++, potentially calling __asm in said C++, etc). Doesn't a JavaScript-based JVM completely render all of that moot? Serious question, I might be (and probably am) misunderstanding something here.

    OTOH, seems like this would be useful for doing a jsfiddle type deal for compiled languages, but then again there's already ideone et. al.



  • @mikeTheLiar said:

    @Zecc said:

    @El_Heffe said:

    Nashorn is the German translation of 'rhinoceros'
    Conflicting information!

    Unless there are more German words for the animal, in which case carry on.

    Rhinos != hippos. Unless you're trying to make some other subtle point that slipped past me.

    Yeah, don't mind me. I need sleep.

     



  • @mikeTheLiar said:

    @PJH said:
    @zelmak said:
    Is there a Java VM written in JavaScript yet?
    Idiocy. More idiocy. It doesn't stop there.

    jsJVM allows execution of Java Bytecode within a web browser without the need for any client side dependancies. [sic]

    This brings some interesting questions to light. IIRC, (in theory) Java has certain security features that prevent you from running potentially malicious code online (e.g., using the JNI to call C++, potentially calling __asm in said C++, etc). Doesn't a JavaScript-based JVM completely render all of that moot? Serious question, I might be (and probably am) misunderstanding something here.

    OTOH, seems like this would be useful for doing a jsfiddle type deal for compiled languages, but then again there's already ideone et. al.

    The JS VM lives within the JS sandbox, so it can't easily access lower level functionality in the same way Java can. It's reasonably safe (as safe as running arbitrary JS), just totally silly.

  • Winner of the 2016 Presidential Election

    So now we need to see a JVM running inside JS running inside a JVM running inside JS...



  • @joe.edwards said:

    So now we need to see a JVM running inside JS running inside a JVM running inside JS...
    You beat me to this.

    Are there any virtual machines (VM like Hyper-V or VMware, not a JVM) that run on Java? Then you could have a Java application running on a JVM running on JS in a web browser running on Windows running on a virtual machine running on a JVM running in JavaScript running in a web browser.



  • @joe.edwards said:

    So now we need to see a JVM running inside JS running inside a JVM running inside JS...

    See here, then nest to your liking...



  • Since Minecraft runs on Java ... we could extend Minecraft using JavaScript ... and get rid of redstone, amiright?



  • @zelmak said:

    Since Minecraft runs on Java ... we could extend Minecraft using JavaScript ... and get rid of redstone, amiright?

    Scriptable Minecraft...that's actually a great idea.



  • @mott555 said:

    @zelmak said:

    Since Minecraft runs on Java ... we could extend Minecraft using JavaScript ... and get rid of redstone, amiright?

    Scriptable Minecraft...that's actually a great idea.


    There's a mod that adds a Lua engine into it, but it would be great if there was a real language in it by default.



  • @joe.edwards said:

    So now we need to see a JVM running inside JS running inside a JVM running inside JS...

       WHOA!!!
         <br>



  • @lushr said:

    @mott555 said:

    @zelmak said:

    Since Minecraft runs on Java ... we could extend Minecraft using JavaScript ... and get rid of redstone, amiright?

    Scriptable Minecraft...that's actually a great idea.


    There's a mod that adds a Lua engine into it, but it would be great if there was a real language in it by default.

    No, no it would not.



  • @Mo6eB said:

    Between Jython, JRuby, Clojure, Scala and Groovy, I'd say practically every kind of language you want to code in on the JVM is covered.

    This list misses a serious WTF:



  • @derari said:

     YO DAWG, IT'S JAVASCRIPT IN JAVA, NOT JAVA IN JAVASCRIPT.

    YO DAWG, I HEARD YOU LIKED JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)

    SO I PUT SOME JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT) IN YOUR JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)

    SO YOU CAN JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT) WHILE YOU JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)



  • @no laughing matter said:

    @Mo6eB said:

    Between Jython, JRuby, Clojure, Scala and Groovy, I'd say practically every kind of language you want to code in on the JVM is covered.

    This list misses a serious WTF:

    Jesus Christ. That gives me a headache just thinking about it.

  • Winner of the 2016 Presidential Election

    @mikeTheLiar said:

    @no laughing matter said:

    @Mo6eB said:

    Between Jython, JRuby, Clojure, Scala and Groovy, I'd say practically every kind of language you want to code in on the JVM is covered.

    This list misses a serious WTF:

    Jesus Christ. That gives me a headache just thinking about it.
    At least they're not porting Go to Java.


  • @no laughing matter said:

    @Mo6eB said:

    Between Jython, JRuby, Clojure, Scala and Groovy, I'd say practically every kind of language you want to code in on the JVM is covered.

    This list misses a serious WTF:

    Quercus: Latin for "oak tree." Cur irrumabo? Latin for "Why the fuck?"

     



  • @eViLegion said:

    @derari said:

     YO DAWG, IT'S JAVASCRIPT IN JAVA, NOT JAVA IN JAVASCRIPT.

    YO DAWG, I HEARD YOU LIKED JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)

    SO I PUT SOME JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT) IN YOUR JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)

    SO YOU CAN JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT) WHILE YOU JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)

    YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME java.lang.StackOverflowError



  • @Ben L. said:

    @eViLegion said:
    @derari said:

     YO DAWG, IT'S JAVASCRIPT IN JAVA, NOT JAVA IN JAVASCRIPT.

    YO DAWG, I HEARD YOU LIKED JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)
    SO I PUT SOME JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT) IN YOUR JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)
    SO YOU CAN JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT) WHILE YOU JAVASCRIPT IN JAVA (NOT JAVA IN JAVASCRIPT)
    YO DAWG, I HEARD YOU LIKED YO DAWG JOKES
    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES
    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES
    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES
    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES
    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES
    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES
    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES
    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES
    SO I PUT SOME java.lang.StackOverflowError

    Sadly, this is the funniest 'yo dawg' joke I've heard in a long time. Sadder still, Ben. L. made me laugh.



  • @mikeTheLiar said:

    Sadly, this is the funniest 'yo dawg' joke I've heard in a long time. Sadder still, Ben. L. made me laugh.
    I often laugh at Ben L.

     



  • @Ben L. said:

    YO DAWG, I HEARD YOU LIKED YO DAWG JOKES


    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME YO DAWG JOKES IN YOUR YO DAWG JOKES

    SO YOU CAN YO DAWG, I HEARD YOU LIKED YO DAWG JOKES

    SO I PUT SOME java.lang.StackOverflowError

    Smallest stack ever.


  • Winner of the 2016 Presidential Election

    @mott555 said:

    Smallest stack ever.

    That's what she said.



  • I can't read the word "stack" without thinking about Kerbal Space Program anymore.



  • @HardwareGeek said:

    @no laughing matter said:

    @Mo6eB said:

    Between Jython, JRuby, Clojure, Scala and Groovy, I'd say practically every kind of language you want to code in on the JVM is covered.

    This list misses a serious WTF:

    Quercus: Latin for "oak tree." Cur irrumabo? Latin for "Why the fuck?"

     

    Wait, wasn't Java originally called Oak?

    Oh shit. I knew paying attention in that community college Java class would pay off eventually!



  • For a moment I thought that Blakey was back.

    Will you post something for christmas ? I'm kind of tired of always getting a lump of coal, I'd really like something nice once.



  • @HardwareGeek said:

    Quercus: Latin for "oak tree."
    <font face="courier new,courier">>> Translator(Portuguese, English).translate("quer cus")

    "Wants asses"

    >></font>

    I wonder if that's why the source for quercus.pt has a line reading:

        var ass90 = jQuery.noConflict();

    as well as:

        <div class="joomla_ass" align="center" >

    I have no idea why at the end of the page they have 16 times this, though:

        <p><a target="_blank" href="https://www.facebook.com/QuercusANCN?ref=ts&amp;fref=ts"></a></p>

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.