• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

What is Java Good For?

{NcsO}ReichstaG

[H]ard|Gawd
Joined
Aug 13, 2004
Messages
1,768
Hello,
I am taking Java courses, and I am just wondering, what is Java good for? The applets don't seem to ideal for websites. 1) I think its much harder to connect an applet to MySQL then it is with php and ajax. 2) There are too many versions out there. If I use the newer Java, people with the older Java, and too lazy to switch to newer runtime environments won't see the applet.
..For writing applications, Java does not seem ideal either. It seems to be slower than a C++ program...and it does not come in .exe files....So I guess you have to write an executable in another language, like C++, to start the Java program...

Even when building simple GUIs with Java ...its probably not as simple as just using Visual Studio .NET to create them...
So why is it so popular...? I am not an expert at all and I am probably missing some part of the picture here...so..Java Gurus..could you explain please

-Thanks
 
Not every piece of code out there is built for web browsers or desktops. The sound engine that a friend of mine and I wrote seemed to work out very well in Java, if you're looking for examples of relatively small projects.

In the wider world, Java is everywhere, and it wouldn't be everywhere if it didn't have some value at some point. Ever heard of ColdFusion? That's Java. My cell phone (for better or worse) runs Java. I once read that Amazon runs on Java, though I have since never been able to find a source for that particular tidbit. Ever heard of BEA? Seems like not too many have these days, but the produce one of the leading J2EE servers out there. They have a ridiculous customer base running Java. :eek:

It's a pity Java is so often misused. A prime example: at my little school (and apparently many others), every damned bit of financial data input has to go through this completely asinine Java applet. When secretaries need to print data (e.g. an account number, a balance, etc.), they're forced to take a screenshot, since you can't copy and paste chunks of text. :rolleyes:
 
doh said:
Teaching first year comp sci students bad habits. :(
Are there any languages out there from which the freshmen wouldn't pick up bad habits? From what I've seen, most of 'em would be better off with a typewriter... ;)
 
HorsePunchKid said:
Are there any languages out there from which the freshmen wouldn't pick up bad habits? From what I've seen, most of 'em would be better off with a typewriter... ;)

LOL

Most first years will never make a good programmer. But the ones that have potential should be taught from the ground up: how the CPU works, how the scheduler works, memory management, etc.

For that purpose C would be a wise choice. It is better to teach with a language that punishes a programmer for misusing memory. Think of all the "bonus points" that could be had for no memory leaks! ;)
 
It's a somewhat-portable language with broad support that works well on the backend. You couldn't pay me enough to write any sort of UI with it.
 
{NcsO}ReichstaG said:
The applets don't seem to ideal for websites. 1) I think its much harder to connect an applet to MySQL then it is with php and ajax.

AJAX, itself, is a PITA. You could just as easily use the same sorts of communication between client and server with a Java applet as you would in an AJAX application & have a useable set of GUI components.

2) There are too many versions out there. If I use the newer Java, people with the older Java, and too lazy to switch to newer runtime environments won't see the applet.
This is why most applets are written using SWT instead of Swing.

..For writing applications, Java does not seem ideal either. It seems to be slower than a C++ program...
...when was the last time you heard a reasonable person say "I need a faster computer so I can run Word"?

and it does not come in .exe files....So I guess you have to write an executable in another language, like C++, to start the Java program...

Even when building simple GUIs with Java ...its probably not as simple as just using Visual Studio .NET to create them...
Yup.

So why is it so popular...? I am not an expert at all and I am probably missing some part of the picture here...so..Java Gurus..could you explain please
Most people are still running Windows on x86 hardware and you have to ask why something that's not the best solution is so popular?
 
It's most often used for it's portability, and ease of use for certain tasks as opposed to C++.

Many things java-related these days are heading down the JSP/J2EE path (big in businesses). Another up and coming technology is JSF (Java Server Faces), as well as Struts.
 
Java has the advantage of being a higher level abstraction than c/c++.

What does that mean? For one it means it is slower, but it also means its harder to make mistakes in Java than c/c++. Java provides protection and abstraction (easier to make/understand source code at higher levels of abstractions), at the cost of a little performance.

Java isn't that slow. Use Java 1.5, its pretty fast.
 
What is Java good for?

Java is good for Web Development. Web Services are leaning more and more towards a JSP/J2EE platform. GMail (and some other Google stuff) is done with AJAX.

Java apps might be unwieldy at times, but in the right hands, they're not better or worse than apps written in any other language.
 
Do a search on Monster.com for programming jobs. Half of them are Java. The other half are .NET. Like it or not, everybody's using Java these days, so you'd better get used to it.
 
Minishark said:
Do a search on Monster.com for programming jobs. Half of them are Java. The other half are .NET. Like it or not, everybody's using Java these days, so you'd better get used to it.

Perhaps half are. ;)
 
doh said:
Perhaps half are. ;)

The company I work for uses both. All the website/CRM stuff is in ASP.NET, and then we're working on rewriting our software in Java. Right now, it's a mess, and all sorts of C/C++ has been added to it since it's original incarnation in the mid-80s in C, so it's time for an update. However, I think the biggest reason for switching to Java isn't necessarily the ease of coding, but the fact that we don't have to write the software twice - once for OSX and once for Windows - which takes up lots of man hours that should be used doing something else.
 
Pyrolistical said:
Java has the advantage of being a higher level abstraction than c/c++.

What does that mean? For one it means it is slower, but it also means its harder to make mistakes in Java than c/c++. Java provides protection and abstraction (easier to make/understand source code at higher levels of abstractions), at the cost of a little performance.
I wouldn't call Ada a very abstracted language, yet it's very hard to make stupid mistakes in it as well :)
 
Who knew? Java is apparently what's going to be driving Blu-Ray discs. Check out the specifications, particularly the A/V & Application specs (PDF). It's a very interesting read and not overly technical.
BD-ROM also provides a fully programmable application environment with network connectivity thereby enabling the Content Provider to create highly interactive, updateable BD-ROM titles. This mode is based on the Java™ platform and is known as “BD-J”. Content Providers are able to include interactive Java applications on a BD-ROM disc in various ways (one application for the entire disc, one application per Title, etc.).
 
HorsePunchKid said:
...I once read that Amazon runs on Java, though I have since never been able to find a source for that particular tidbit...
amazon runs on perl
 
If you look at the history of Java and it's official JVM spec, you'll notice that Java is not a 'language' per se so much as it is the spec for an abstract CPU. The JVM spec at its core defines the functioning and functionality of a CPU that has been abstracted very far out.

That's why we say that Java source code is translated into ByteCode. These bytecodes are synonymous with OpCodes found on a normal CPU. To this end, JVM could be implemented (and has been by some companies) as actual silicon that runs as fast or faster than a normal CPU. (read this article for more: http://www.microjava.com/jvm/hardware/native/ajile2?content_id=1085 )

This is where Java is at its deadliest. Sure, there are a lot of classes these days that are specialized to one architecture or another, but if you steer clear of those, you should be able to run any code you write (if you write it to spec) anywhere that you like.

One of the classic examples I hear is of how "Java isn't platform independent because my serial port comm app doesnt work under <insert OS>." Nine times out of ten, the programmer hard-coded port names, like COM1 or COM2, instead of properly enumerating the ports on the fly and such.

Also, to address the .exe issue, these days it IS possible to package a Java app as an .exe that is just handed over to the JVM for processing. You just need to know how to package your app as such.
 
svet-am said:
If you look at the history of Java and it's official JVM spec, you'll notice that Java is not a 'language' per se so much as it is the spec for an abstract CPU. The JVM spec at its core defines the functioning and functionality of a CPU that has been abstracted very far out.

That's why we say that Java source code is translated into ByteCode. These bytecodes are synonymous with OpCodes found on a normal CPU. To this end, JVM could be implemented (and has been by some companies) as actual silicon that runs as fast or faster than a normal CPU. (read this article for more: http://www.microjava.com/jvm/hardware/native/ajile2?content_id=1085 )

This is where Java is at its deadliest. Sure, there are a lot of classes these days that are specialized to one architecture or another, but if you steer clear of those, you should be able to run any code you write (if you write it to spec) anywhere that you like.

One of the classic examples I hear is of how "Java isn't platform independent because my serial port comm app doesnt work under <insert OS>." Nine times out of ten, the programmer hard-coded port names, like COM1 or COM2, instead of properly enumerating the ports on the fly and such.

Also, to address the .exe issue, these days it IS possible to package a Java app as an .exe that is just handed over to the JVM for processing. You just need to know how to package your app as such.

Yup, would be nice if we could get a Java co-processor or add-on board for x86...

I bet Intel or AMD can do it. With all the hype (good or bad?) with Java these days, it wouldn't be that far fetched.
 
Pyrolistical said:
Yup, would be nice if we could get a Java co-processor or add-on board for x86...

I bet Intel or AMD can do it. With all the hype (good or bad?) with Java these days, it wouldn't be that far fetched.
I, too, think that that would be neat. I'd pay for it if only for my own Java development. However, some of these Java 'microcontrollers' exist on a lot of cell phones. In fact, I think the Motorola RAZR uses one (but, I'll have to check to confirm that).
 
One of my friends from school (UNC CompSci) interned at amazon over the summer. They use Java for tools and some utilities as well as a lot of their web stuff, c/c++ for mission critical apps. No mention of perl, though.
 
Java's also good for rapid prototyping. It's garbage collection and relative protectiveness against doing stupid stuff helps when you're just trying to get something done.
 
It's good for very large projects with big corporations. Supposedly.

Though servlets aren't bad,
 
svet-am said:
If you look at the history of Java and it's official JVM spec, you'll notice that Java is not a 'language' per se so much as it is the spec for an abstract CPU. The JVM spec at its core defines the functioning and functionality of a CPU that has been abstracted very far out.

That's why we say that Java source code is translated into ByteCode. These bytecodes are synonymous with OpCodes found on a normal CPU. To this end, JVM could be implemented (and has been by some companies) as actual silicon that runs as fast or faster than a normal CPU. (read this article for more: http://www.microjava.com/jvm/hardware/native/ajile2?content_id=1085 )

This is where Java is at its deadliest. Sure, there are a lot of classes these days that are specialized to one architecture or another, but if you steer clear of those, you should be able to run any code you write (if you write it to spec) anywhere that you like.

One of the classic examples I hear is of how "Java isn't platform independent because my serial port comm app doesnt work under <insert OS>." Nine times out of ten, the programmer hard-coded port names, like COM1 or COM2, instead of properly enumerating the ports on the fly and such.

Also, to address the .exe issue, these days it IS possible to package a Java app as an .exe that is just handed over to the JVM for processing. You just need to know how to package your app as such.

I'm a EE major. But in a robotics course where I'm doing alot of java work. I limp through creating java programs and could really use a good example of this. Most development is on PC and the robot is linux. for now I just specify manually, but seeing how to do it automatically would be sweet!
 
Java is good for paying your bills !

Seriously, I get paid to write Java code.

I write server side applications.
 
Menelmarar said:
I'm a EE major. But in a robotics course where I'm doing alot of java work. I limp through creating java programs and could really use a good example of this. Most development is on PC and the robot is linux. for now I just specify manually, but seeing how to do it automatically would be sweet!
I'm a CPE and at my alma mater (Mississippi State) there is a course called Embedded Systems which is all Java and includes getting PCB fabbed that includes a JVM in silicon.

What exactly do you need an example of? I could probably provide you with several.

<edit> on second reading, I realized what you are curious about. Consult the Java Comm API examples called SimpleRead.Java and SimpleWrite.java Those can be linked from here: http://java.sun.com/products/javacomm/javadocs/API_users_guide.html

The appropriate code to see how to do the port enumeration properly is:

Code:
  	portList = CommPortIdentifier.getPortIdentifiers();
 
 	while (portList.hasMoreElements()) {
 	    portId = (CommPortIdentifier) portList.nextElement();
 	    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
 		if (portId.getName().equals(defaultPort)) {
 		    System.out.println("Found port: "+defaultPort);
 		    portFound = true;
 		    SimpleRead reader = new SimpleRead();
 		} 
 	    } 
 	}
 
LordBritish said:
Java is good for paying your bills !

Seriously, I get paid to write Java code.

I write server side applications.

This guy knows what he's talking about. It doesn't matter if you don't personally think Java is a good language. What matters is that everyone is using it these days, so if you want to get a job you'd better get used to programming in it.
 
Back
Top