• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can java be used as javascript been used?

 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the difference between javascript and java
can we use java instead of java script?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you posted in this forum, I assume you are talking about client-side scripting.
Then, no. JavaScript and Java are completely different languages (and JavaScript is so named only because Java was the cool buzz-word of the moment when Netscape implemented ECMA-script for its browser). It could just as well have been called CScript, C++Script or ShmugglyScript.
There is no provisions in any known browser for utilizing Java as a scripting language (applets are a whole other ball of wax).
Java certainly can be used as a server-side language (that's what JSP is all about).
So why do you ask? What are you trying to accomplish that JavaScript won't do for you?
hth,
bear
[ February 14, 2003: Message edited by: Bear Bibeault ]
 
senthil sen
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi bear,
well i know java can be used on the server side and all the advanced difference between java and javascript,
and well even java script can be used on the server side..
all i want to know are the basic differences like
Does javascript support oops?
Java support events like it has in applets??
and so on..
so any basic difference between them??
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Javascript is just client based, you can not use it on the server side. Javscript is quick neat and clean and does not need the applets to run.
I can not code in Java, just many other languages. Javascript, you can create objects and there is a question about that near the middle of the forum list.
Javascript can detect all mouse movements, almost every key on the keyboard (not the print screen key), detect clicks, focus, etc.
Very easy open source code that anyone can learn, esp. if the person knows c or c++.
Biggest differnce between javascript and applets is, none of that class stuff needs to be loaded. Javascript tajes milliseconds to load while applets take seconds upon seconds.
Now applets have some features that are not supported well in all the browsers. Text display is one of them. IE supports cerain filters in the browser and Netscape doesn't. That is why it makes it hard in Javascript.
everyone that does javascript/DHTML knows these lines:
if(document.all){}
if(document.getElementById){}
if(Document.layers){}
look at any good site:
http://www.dynamicdrive.com
http://www.javascriptkit.com
or even mine at the bottom, you can see what javascript can do.
Now that I probably made no sense and bored you to bits, I will end this babble.
Eric
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, NS4 had LiveConnect technology, that was allowing you to use Java with JavaScript. (I am not sure, does they support it in NS6+ ).
So, there are some example for JavaScript using LiveConnect (took them from JS1.3 User Guide for NS):
var myString = new java.lang.String("Hello world");
var theInt = java.lang.Class.forName("java.lang.Integer")
var x = java.lang.reflect.Array.newInstance(theInt, 10);

Another interesting solution at this link shows use of java.awt.TextArea instead of HTML element:
http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric wrote: Javascript is just client based, you can not use it on the server side.
Well, in some (faily rare) cases you can use JavaScript on the server side. It's just a programming language, after all.
The popular Resin Servlet/JSP engine will allow you to use JavaScript instead of Java as the language for embedded code in JSPs, although this support will probably be deprecated in the new version 3.0.
Likewise some other servers allowed JavaScript as a server-side scripting language before the market settled on ASP/COM, JSP/Servlets and PHP.
Finally, JavaScript (a.k.a "Rhino", a.k.a "EcmaScript") is one of the languages supported by the BSF framework, so you can use it together with any of your Java code including servlets and Java CGIs. I know of several projects which use JavaScript as a scripting language within the Ant build tool, for example.
The great majority of JavaScript code runs in browsers, though.
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic