PDA

View Full Version : Uses for Java?



james438
07-25-2007, 04:35 PM
Sorry for the lazy question, but what are some things that Java is used for in a website? Or is it mostly for offline work. I am very unfamiliar with Java an am thinking of dabbling in a more interactive language like Javascript. Yes, I know there is a big difference between the two, but I am having a somewhat harder time grasping some of the potential of Java and what IT can do.

Twey
07-25-2007, 05:01 PM
It can do practically anything. It's used for server-side servlets, frameworks, non-HTTP services, and also for client-side applets, which can interact with Javascript seamlessly. The only limitation is that it's a plugin. Unfortunately, that means Javascript is usually a better choice where possible. Java is generally used where something can't be done in Javascript.

Snorkle?
08-24-2007, 08:40 PM
Ok so, theres two sides to Java. Applications, and Applets. Java Applications are ran with the MS-DOS, or command line. Java Applets are ran with a appletviewer, or your web browser (web browser has to have a java plug-in).

Java Applications are written from a text editor program (such as notepad), compiled using the "Javac" command into a class, and then ran all in MS-DOS.

Java Applets are written in a text editor program, compiled into a class by using the "Javac" command, then you are to create a html (Hyper-text-markup-language) document, which you will then use the:

<APPLET></APPLET>
tags.
Lets say your class name is: Wonderful.class
it would be:

<APPLET CODE="Wonderful.class", WIDTH=300, HEIGHT=400></APPLET>

As you well know, Java Applets can create animated pictures, games, and more!

Twey
08-24-2007, 09:38 PM
Ok so, theres two sides to Java. Applications, and Applets.There are a lot more things that can be done with Java (servlets for a start), but they're not different enough to be considered "sides" of Java. The only difference between servlets, applets and applications is how they're called. There's no fundamental difference to the Java programmer: an application can usually be "converted" to an applet just by adding an appropriate start() method, and an applet can generally be "converted" to an application just by adding a main() method that instantiates the applet and calls its start(). The same program, if it has both a main() and a start() method, can be both an application and an applet (although applications generally require a (J)Frame in which to display the (J)Applet).
Java Applications are ran with the MS-DOS, or command line.MS-DOS doesn't even exist on recent versions of Windows (cmd.exe is not DOS), nor does it exist on many of the other systems that are supported by Java. Moreover, Java is perfectly capable of creating graphical applications, and the standard runtime library contains not one but two toolkits (AWT and Swing) for precisely this purpose.
then you are to create a html (Hyper-text-markup-language) document, which you will then use the:
<APPLET></APPLET>tags.Hyper-Text-Markup-Language-is-three-words-one-of-which-can-be-hyphenated-not-one-big-one-with-hyphens-instead-of-spaces (deep breath). More importantly, the <applet> element is deprecated for <object> and has been for quite some time.

Snorkle?
08-24-2007, 10:02 PM
Hyper-Text-Markup-Language-is-three-words-one-of-which-can-be-hyphenated-not-one-big-one-with-hyphens-instead-of-spaces (deep breath).

hehe (deep breath). I know im not up to date with Java since Iam using Java 2.0, and that im running it on my grandma's computer which has windows millenium with a netscape navigator browser. So yeah, I'm glad you told me these things, and i will be sure to say the most-up to date thing i can think of

Twey
08-25-2007, 12:39 AM
When I say "quite some time" I mean "since the advent of HTML4, about a decade ago" :) The other points I made have always been the case, even in Java 1.

Snorkle?
08-25-2007, 01:27 AM
so your sayin i can use <OBJECT CODE=".CLASS">

Snorkle?
08-25-2007, 01:28 AM
about the MS-DOS though, my windows says thats what it is...

Twey
08-25-2007, 02:02 PM
so your sayin i can use <OBJECT CODE=".CLASS">That's not how <object> works. See HTML 4.01 &#167;13.3 Generic Inclusion: the OBJECT element (http://www.w3.org/TR/html401/struct/objects.html#edef-OBJECT).
about the MS-DOS though, my windows says thats what it is...Windows ME still does have DOS. Later versions don't. I'm unsure if it was removed in NT or 2000.

jscheuer1
08-26-2007, 09:59 AM
Windows ME still does have DOS. Later versions don't. I'm unsure if it was removed in NT or 2000.

There's DOS (disk operating system) and there is DOS (the command prompt). I never had 2000 or ME (sounds like the same thing). NT was the first OS I used that didn't rely upon DOS as a disk operating system in the traditional way of former Windows machines, but it still did bootstrap from a form of it, as does XP (has autoexec.bat and config.sys, but doesn't really rely upon them), Vista may be another story, I'm not familiar with it yet. I later configured a legacy machine to use 95, it still used DOS as the primary OS, though it skipped over it as fast as possible (not nearly fast enough, in most folk's opinions). In NT, the supplied DOS prompt had many more capabilities than previously, like 4DOS, if anyone recalls that. XP is an advanced (from the point of view of the folks writing the OS) version of NT.

Twey
08-26-2007, 10:08 AM
I never had 2000 or ME (sounds like the same thing).No -- Win2k was an NT-based OS, while ME was still based on the 9x series.
NT was the first OS I used that didn't rely upon DOS as a disk operating system in the traditional way of former Windows machines, but it still did bootstrap from a form of it, as does XPNTLDR (the NT LoaDeR, NT's bootloader) isn't DOS, and neither is the "command prompt" program in later versions of Windows (cmd.exe). It's been made to resemble DOS, but it's fairly fundamentally different, reflecting its reduced r&#244;le in the running of the OS -- it's no longer an operating system, for a start, and runs as a program under Windows. The thing I'm unsure about is whether NT still had actual DOS, despite no longer booting from it.

jscheuer1
08-26-2007, 10:29 AM
Well, it does get confusing. When the machine starts to boot up, you can go into the disk operating system (DOS) rather than launch the GUI, but it isn't DOS (isn't identified as a DOS version) and still has some GUI elements. The command prompt is often thought of as DOS, but it isn't the disk operating system. At the same time, it exhibits many of the capabilities (and in NT, considerably more) of DOS, the historic OS.

Snorkle?
08-26-2007, 03:10 PM
Yeah, i have windows ME, sadly enough...

Twey
08-26-2007, 06:53 PM
Well, it does get confusing. When the machine starts to boot up, you can go into the disk operating system (DOS) rather than launch the GUI, but it isn't DOS (isn't identified as a DOS version) and still has some GUI elements.You mean TUI elements? Is this in NT?
The command prompt is often thought of as DOS, but it isn't the disk operating system.This is where the confusion arises: in Win9x, it is. The "command prompt" is just a way to interact with an actual DOS shell.

jscheuer1
08-26-2007, 09:14 PM
To me the confusion arises in MS's having named some rather important things after their generic designations. The two biggest examples of this are using Windows for their versions of windows and DOS for their early versions of disk operating systems.

james438
08-30-2007, 09:55 PM
If I were to try and create a script that will prepend an append highlighted text with HTML tags (or maybe CSS) by clicking a button I imagine that JavaScript and Java would both work just fine.

If this is just for my own benefit for coding and not for the general public would Java or JavaScript be better? Is one faster or simpler in this regard?

I'll probably head to the bookstore and pick up a book on JavaScript sometime soon.

Twey
08-30-2007, 11:08 PM
If I were to try and create a script that will prepend an append highlighted text with HTML tags (or maybe CSS) by clicking a button I imagine that JavaScript and Java would both work just fine.It would be a lot simpler in Javascript, however. Java applets don't have much access to the document in which they're embedded, by default.
If this is just for my own benefit for coding and not for the general public would Java or JavaScript be better? Is one faster or simpler in this regard? Java is a plugin; thus, it takes longer to load and some people won't have it installed. Javascript is preferable.