JavaScript != Java

Lately I've been doing a lot of work with Java and JavaScript through JavaScript Engine and every time I come to a question about the two someone feels the need to answer the question with, "Java and JavaScript are two different languages. They have nothing in common!" or "Just because the word Java is in JavaScript doesn't mean its Java" or "Java != JavaScript".

Well OK... That doesn't answer the question and it is so irrelevant because you can obviously use Java inside of JavaScript and you can use JavaScript inside of Java so just because someone is asking a question about the two doesn't mean they think they're are the same language.

So my question is how come so many people seem to get worked up over the fact someone is trying to use Java and JavaScript together and will dismiss the question with their condescending phrases instead of offering a solution?

Here is an example,

var SwingGui = JavaImporter(Packages.javax.swing,
                    Packages.javax.swing.event,
                    Packages.javax.swing.border,
                    java.awt.event,
                    java.awt.Point,
                    java.awt.Rectangle,
                    java.awt.Dimension);
...

with (SwingGui) {
var mybutton = new JButton(test);
var mypoint = new Point(10, 10);
var myframe = new JFrame();

}

sources:

https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Scripting_Java

http://docs.oracle.com/javase/7/docs/technotes/guides/scripting/programmer_guide/

http://www.oracle.com/technetwork/articles/javase/scripting-140262.html

#javascript #java

4.10 GEEK