Jump to content

Difference Between JavaScripts and Java

Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Difference Between JavaScripts and Java Rate Topic: -----

#1 User is offline   Jessica 

  • W.R. Private
  • Group: Members
  • Posts: 5
  • Joined: 23-January 09

Posted 23 January 2009 - 07:40 AM

JAVASCRIPTS IS NOT A JAVA:

Java is a compiled language. This means that the Java code must be transformed ("compiled") into a high-level programming language before it can run.

JavaScript is an interpreted language. It doesn't need to be compiled before it is run. In an interpreted language the instructions are parsed (divided into small components that can be analyzed). For instance, as the browser "reads" this page, it breaks down each of the page's components into individual components and interprets each component as it moves down the page. In linguistics it means to divide language into small components that can be analyzed. For example, parsing this sentence would involve dividing it into words and phrases and identifying the type of each component (such as a verb, adjective, or noun).
1

#2 User is offline   soumali 

  • W.R. Private
  • Group: Members
  • Posts: 2
  • Joined: 15-September 09

Posted 20 September 2009 - 04:43 AM

They are both similar and quite different depending on how you look at them. First their lineage:

Java is an Object Oriented Programming (OOP) language created by James Gosling of Sun Microsystems. JavaScript was created by the fine people at Netscape. JavaScript is a distant cousin of Java. It is also an OOP language. Many of their programming structures are similar. However, JavaScript contains a much smaller and simpler set of commands than does Java. It is easier for the average weekend warrior to understand.





You may be wondering what OOP means by now. Object Oriented Programming is a relatively new concept, whereas the sum of the parts of a program make up the whole. Think of it this way: you are building a model car. You build the engine first. It can stand alone. It is an engine and everyone can see it's an engine. Next you build the body. It can also stand alone. Finally, you build the interior including the seats, steering wheel, and whatnot. Each, by itself is a object. But it is not a fully functioning car until all the pieces are put together. The sum of the objects (parts) make up the whole.

Continuing with the model car example, when you built the engine, you didn't use any of the parts that would later build the seats (a 350 four-barrel engine with a seat belt sticking out if the piston would look pretty silly). The point is that all the parts that made up the engine were of a certain class of parts. They all went together. Ditto with the body and then the interior.

The point is that in these languages, you build objects out of classes of commands to create the whole. Understand the terminology? Good. Moving along...

Now let's talk about how Java and JavaScript differ. The main difference is that Java can stand on its own while JavaScript must be placed inside an HTML document to function. Java is a much larger and more complicated language that creates "standalone" applications. A Java "applet" (so-called because it is a little application) is a fully contained program. JavaScript is text that is fed into a browser that can read it and then is enacted by the browser.

Another major difference is how the language is presented to the end user (that's you when you're surfing). Java must be compiled into what is known as a "machine language" before it can be run on the Web. Basically what happens is after the programmer writes the Java program and checks it for errors, he or she hands the text over to another computer program that changes the text code into a smaller language. That smaller language is formatted so that it is seen by the computer as a set program with definite beginning and ending points. Nothing can be added to it and nothing can be subtracted without destroying the program.

JavaScript is text-based. You write it to an HTML document and it is run through a browser. You can alter it after it runs and run it again and again. Once the Java is compiled, it is set. Sure, you can go back to the original text and alter it, but then you need to compile again.









Web Site Promotions

This post has been edited by soumali: 20 September 2009 - 04:48 AM

0

#3 User is offline   Rob Kaper 

  • W.R. Corporal
  • Group: Members
  • Posts: 97
  • Joined: 19-July 08
  • Gender:Male
  • Location:Rotterdam, NLD

Posted 22 October 2010 - 01:30 PM

Java and Javascript look alike in name, but that's about the only similarity.

  • Java needs to be compiled first, Javascript is interpreted by the application supporting it.
  • Almost all browsers support Javascript natively, not all support Java without an additional download.
  • Javascript in a browser has little access to your computer other than some browser functions such as writing and reading cookies. Java ordinarily can access any of your files and even start other applications.


Unless you specifically need access to local files (other than ones explicitely uploaded of course) or applications, simply ignore Java, especially if you have to ask this question. Back in the days a Java applet could be an acceptable choice for interactivity in the browser, but nowadays that's the domain of Javascript (and Flash).

@soumali: Javascript can actually be used outside a browser, an example is Adobe AIR which basically allows you to develop an application using HTML, CSS and Javascript which runs locally. Tweetdeck uses it.
Rob Kaper - Rotterdam
0

#4 User is offline   che09 

  • W.R. Corporal
  • Group: Members
  • Posts: 50
  • Joined: 22-November 10

Posted 28 November 2010 - 08:11 PM

Javascript is used for front-end web development while Java can only be used as a back-end language within a web environment. Java doesn't need a web browser to compile and execute like Javascript does. Java is compiled prior to runtime while Javascript is compiled at runtime. The syntax/reserved-words are also different.
0

#5 User is offline   Joe Develper 

  • W.R. Corporal
  • Group: Members
  • Posts: 50
  • Joined: 07-December 10
  • Gender:Male
  • Interests:Web development, Internet Surfing etc.

Posted 07 December 2010 - 04:41 AM

View PostJessica, on 23 January 2009 - 07:40 AM, said:

JAVASCRIPTS IS NOT A JAVA:

Java is a compiled language. This means that the Java code must be transformed ("compiled") into a high-level programming language before it can run.

JavaScript is an interpreted language. It doesn't need to be compiled before it is run. In an interpreted language the instructions are parsed (divided into small components that can be analyzed). For instance, as the browser "reads" this page, it breaks down each of the page's components into individual components and interprets each component as it moves down the page. In linguistics it means to divide language into small components that can be analyzed. For example, parsing this sentence would involve dividing it into words and phrases and identifying the type of each component (such as a verb, adjective, or noun).


Yes, thats right! Java, developed under the Sun Microsystems brand, is a full-fledged object-oriented programming language. It can be used to create standalone applications and a special type of mini application, called an applet. Applets are downloaded as separate files to your browser alongside an HTML document, and provide an infinite variety of added functionality to the Web site you are visiting. The displayed results of applets can appear to be embedded in an HTML page (e.g., the scrolling banner message that is so common on Java-enhanced sites), but the Java code arrives as a separate file.

JavaScript, developed by Netscape, is a smaller language that does not create applets or standalone applications. In its most common form today, JavaScript resides inside HTML documents, and can provide levels of interactivity far beyond typically flat HTML pages -- without the need for server-based CGI (Common Gateway Interface) programs.

Some server software, such as Netscape's SuiteSpot, lets web application developers write CGI programs in a server-side version of JavaScript. Both client-side and server-side JavaScript share the same core JavaScript language, but each side deals with different kinds of objects. Client-side objects are predominantly the components of an HTML web page (e.g., forms, text boxes, buttons). Server-side objects are those that facilitate the handling of requests that come from clients, as well as connectivity to databases

It is important to understand that a Java-enabled browser is not automatically a JavaScript-enabled browser: the two technologies require entirely separate interpreters (licensed from separate companies) to handle the languages. It is unlikely, however, that future browsers will incorporate one but not the other (plus or minus implementation timetables on various platforms).

Starting with Netscape Navigator 3.0, HTML authors have been able to use JavaScript to link HTML form elements to Java applets (and plug-ins) or link Java applets to each other--LiveConnect™, Netscape calls this technology. Rather than competing with each other, Java and JavaScript are a powerful combination.

Much simpler and smaller than the Java vocabulary, JavaScript is within reach of authors who know HTML; writing full-fledged Java, on the other hand, benefits from experience with C and C++. Java and JavaScript share a number of vocabulary and syntax constructions, but the languages are intended for very different purposes.
0

#6 User is offline   contrariwise 

  • W.R. Private
  • Group: Members
  • Posts: 7
  • Joined: 08-December 10
  • Gender:Not Telling
  • Location:Near Santa
  • Interests:steampunk robots, no tea, convincing non-geeks that I fit in with them, counting solipsists, pretending i'm a time traveler

Posted 09 December 2010 - 05:06 AM

I think even the phrase "Difference Between JavaScripts and Java" is misleading. They are two entirely different languages, so there is no need to compare them in the first place. It's surprising how many people don't know this though.

Just yesterday I was talking to a guy who told me he hates Java. I know there is a lot of Java hate, so I wasn't too surprised and I asked him why. His answer was very confusing for about a minute until I realized that he was talking about Javascript, not Java. I guess even people who know Javascript don't know it's not Java.
0

#7 User is offline   JakeMcGreg 

  • W.R. Private
  • Group: Members
  • Posts: 46
  • Joined: 15-December 10

Posted 17 January 2011 - 10:52 PM

Now it won't leave to any confusion now. At first when I encountered JavaScripts I though Java is just the shortcut name. Now I know the difference. Thanks a lot for elaborating the big difference.
Website Design Packages - CMS Website, SEO Tools & a personalised 12 month strategy guide
0

#8 User is offline   Fahrenheit 

  • W.R. Private
  • Group: Members
  • Posts: 5
  • Joined: 17-February 11

Posted 17 February 2011 - 11:38 PM

Sorry to be doubly redundant, but it is amazing how many people, including industry insiders, don't understand the difference between Java and JavaScript. Here's the low-down.

Java, developed under the Sun Microsystems brand, is a full-fledged object-oriented programming language. It can be used to create standalone applications and a special type of mini application, called an applet. Applets are downloaded as separate files to your browser alongside an HTML document, and provide an infinite variety of added functionality to the Web site you are visiting. The displayed results of applets can appear to be embedded in an HTML page (e.g., the scrolling banner message that is so common on Java-enhanced sites), but the Java code arrives as a separate file.

JavaScript, developed by Netscape, is a smaller language that does not create applets or standalone applications. In its most common form today, JavaScript resides inside HTML documents, and can provide levels of interactivity far beyond typically flat HTML pages -- without the need for server-based CGI (Common Gateway Interface) programs.

Some server software, such as Netscape's SuiteSpot, lets web application developers write CGI programs in a server-side version of JavaScript. Both client-side and server-side JavaScript share the same core JavaScript language, but each side deals with different kinds of objects. Client-side objects are predominantly the components of an HTML web page (e.g., forms, text boxes, buttons). Server-side objects are those that facilitate the handling of requests that come from clients, as well as connectivity to databases

It is important to understand that a Java-enabled browser is not automatically a JavaScript-enabled browser: the two technologies require entirely separate interpreters (licensed from separate companies) to handle the languages. It is unlikely, however, that future browsers will incorporate one but not the other (plus or minus implementation timetables on various platforms).

Starting with Netscape Navigator 3.0, HTML authors have been able to use JavaScript to link HTML form elements to Java applets (and plug-ins) or link Java applets to each other--LiveConnect™, Netscape calls this technology. Rather than competing with each other, Java and JavaScript are a powerful combination.

Much simpler and smaller than the Java vocabulary, JavaScript is within reach of authors who know HTML; writing full-fledged Java, on the other hand, benefits from experience with C and C++. Java and JavaScript share a number of vocabulary and syntax constructions, but the languages are intended for very different purposes.

All you need to program in JavaScript is a text editor and a JavaScript-enabled browser, such as Netscape Navigator 2.0 and later or Microsoft Internet Explorer 3 and later.
0

#9 User is offline   Rob Kaper 

  • W.R. Corporal
  • Group: Members
  • Posts: 97
  • Joined: 19-July 08
  • Gender:Male
  • Location:Rotterdam, NLD

Posted 18 February 2011 - 04:35 AM

View PostFahrenheit, on 17 February 2011 - 11:38 PM, said:

It is unlikely, however, that future browsers will incorporate one but not the other (plus or minus implementation timetables on various platforms).

...

All you need to program in JavaScript is a text editor and a JavaScript-enabled browser, such as Netscape Navigator 2.0 and later or Microsoft Internet Explorer 3 and later.


Did you just copy something from the Internet to show off knowledge here? The majority of current browsers have Javascript support out of the box but require an additional plug-in for Java, while no one in their right mind would still mention Netscape Navigator (or IE3 for that matter) in a current discussion.
Rob Kaper - Rotterdam
0

#10 User is offline   EncoderDecoder 

  • W.R. Sergeant
  • Group: Members
  • Posts: 260
  • Joined: 01-March 11
  • Gender:Female
  • Location:Philippines

Posted 01 March 2011 - 12:33 PM

Java is actually very different from Javascript.. They are not even comparable.. Java is a programming language while Javascript is a scripting language.. that's two different high-level language we got here..
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users