Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Replies: 17 - Pages: 2   [ 1 2 | Next ]
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Unix: 10 Things Every Java Developer Should Know

At 10:15 AM on Jun 19, 2006, Matthew Schmidt wrote:

One of the great things about Java is how multi-platform it really is. While cross platform glitches do occur, they are not really all that common. But since the law of unintended consequences is all pervasive, we now have the common sight of teams of developers building Java programs meant to run on Unix boxes on Windows.

Read on for more of the Ten Things Every Java Developer Should Know About Unix by Russ Olsen.
1 . At 6:46 PM on Jun 19, 2006, Schalk Neethling wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

Great article, thanks Russ.
2 . At 4:41 AM on Jun 20, 2006, Gernot Veith wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

so far so good. But I don't agree with the registry section. On Unlix/Linux/Mac OS X the preferences are stored in a XML file in the (AFAIK) user's home dir.
BTW: as Java is platform independent, you should test your apps on all platfroms you want to run them, not only on Linux. There are e.g. as well some Mac OS X originalities, non - Mac OS X users (like I was) don't know.
3 . At 6:26 PM on Jun 20, 2006, Will Hartung DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

> 9) There is no magic file locking

This is a feature, not a bug.

> 7) In Unix, there is no registry...

No, but there is the Java Preferences API, which is user based and cross platform. This is, of course, for your own programs. He's quite correct about system information that may be stored in a Windows registry will need to be accessed in some other way, and that way may be different from Unix to Unix.

> 6) Forward slashes are your friend

Actually, Java IS NOT smart enough to translate /this/that to \this\that. Windows, however, IS smart enough. (I do believe Ant is smart enough also, but that's an Ant thing, not a Java thing.)

> 5) Our services are just programs

...and if you want the cheapest Network Aware service on the planet, the Internet Super Server on Unix boxes is your friend. inetd can turn any program that reads and write Standard Input and Ouput in to a network daemon with a port, a listener, the whole ball of wax. When something shows up on the port, it starts up the process binding stdin and stdout to the socket. Voila!

Yes, many admins gut this service relentlessly or disable it completely. Why, of course they're not secure. No, you don't want to have such a service Slashdotted. But that doesn't make them any less viable, simple, and utilitarian when properly applied.

> 2) There is no carriage to return.

Java's in built BufferedReader and PrintWriter are smart enough to know the difference, and not distinguish. You can use BufferedReader.readLine() pretty much with impunity in 99% of the situations. It will read Unix files on Windows, Windows file on Unix, etc. It will even read original Mac files (which just use CR, with no LF). I have no idea what it does on an AS/400, I'm assuming the Right Thing, but the AS/400 may still run EBCIDIC for all I know.

PrintWriter using PrintWriter.println() will generate the platform appropriate EOL terminators.

And if you're transferring text files from Windows to Unix or vice-a-versa, well, that's why FTP has the ASCII command.
4 . At 7:41 PM on Jun 20, 2006, Russ Olsen wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

Gernot,

I think that there is a lot more in the windows registry than just preferences. On windows if you screw up your
registry, you haven't just lost your perferences, you have probably messed up your whole OS.

I agree that OS X tends to be a bit of a world apart. But I would still contend that if you are a windows person, you can get a lot of education out of a free, bootable linux disk.

Russ
5 . At 5:29 AM on Jun 22, 2006, Don Corley wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

11. File names are case sensitive on Unix. If you create a file called "Myfile.txt" then try to open "myfile.txt" you'll get an error.
6 . At 10:00 AM on Jun 22, 2006, Dave Ferguson wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

A very nice article... In terms of #8, I remember we ran into Java exception when our web application was deployed on a customer's Solaris server. We were using a package to generate charts (jpegs) on the fly and the code was using AWT libraries which of course didn't work. All our testing had been done on Windows and UNIX w/GUI.
7 . At 1:04 PM on Jun 22, 2006, Gene De Lisa wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

I learned the most important thing back in 1982 on a PDP-11:

Unix and Eunuchs are two different things.
8 . At 5:46 PM on Jun 22, 2006, Gregory Pierce DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

1) You need a Linux box


Not really. If you've got an OSX box (preferably one running Intel processors) you'll be just fine as well.
9 . At 1:06 PM on Jun 23, 2006, Ivan Markov DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

Since 1.4:
-Djava.awt.headless=true

..and you can use the AWT/Graphics2D machinery even if there is no X server running: Java2D will render in software.
10 . At 6:28 PM on Jun 23, 2006, Russ Olsen wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

Don,

Actually I think that:

11. File names are case sensitive on Unix. If you create a file called "Myfile.txt" then try to open "myfile.txt" you'll get an error.

Should really be # 0. I left it out because I assumed that
just about everyone knows that one. But good point.

Russ
11 . At 5:05 AM on Jun 24, 2006, Ivan Markov DeveloperZone Top 100 wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

> 11. File names are case sensitive on Unix. If you
> create a file called "Myfile.txt" then try to open
> "myfile.txt" you'll get an error.
>
> Should really be # 0. I left it out because I assumed
> that
> just about everyone knows that one. But good point.

How about this:
File names are case INsensitive (and case preserving, like NTFS) on Mac OS X (HFS+), despite the FreeBSD heritage, and due to Mac OS 9 compatibility, I guess..
12 . At 11:15 AM on Jun 27, 2006, Ricky Ng-Adam wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

For #10, I would suggest Windows-based Java developers take a look at CoLinux (http://colinux.sourceforge.net/), a port of Linux on Windows. Doesn't require a second machine or special partition, runs on Windows and the performance is excellent. Combined with Xming (http://sourceforge.net/projects/xming) it makes it easy to have two Eclipse, one Windows and one Linux, running on the same computer.
13 . At 8:12 AM on Jun 28, 2006, OrangeBook wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

Nothing to see here.

The problems commented here come just from assuming a given plattform. Java programmers shouldn't. Who the hell would worry about the windows registry when writing Java apps? How windows-centric you have to be to think in "services"? You are coding Java, remember?

These problems arise when you have been coding Java *for Windows*, which is always wrong: the plattform addresses them quite well and allows you to do what you want in an independent way.

These are not advices for Java programmers, these are advices for those bad Java programmers (newbies?) who wrongly assume a plattform, and while kinda true they seem quite naive to me.

The funniest one is #1: You need a Linux box... No!... Really???
14 . At 12:10 AM on Jun 29, 2006, Russ Olsen wrote:
  Click to reply to this thread Reply

Re: Unix: 10 Things Every Java Developer Should Know

> The problems commented here come just from assuming a given plattform. Java programmers shouldn't. Who the hell would
> worry about the windows registry when writing Java apps? How windows-centric you have to be to think in "services"?
> You are coding Java, remember?

I think you raise an interesting point. You see, were I to start building a new development team today, I would not hire any Java programmers. Not a single one. I would hire people who can build systems using Java, but I anyone
who simply wanted to limit his or herself to 'pure' Java would really have to look elsewhere.

The ideal of a platform independent language is wonderful and Java has come closer to it than anything that has come before. But it is not now, and I don't see how it will ever be, 100%. Given that, I think that developers need to understand their target platform. Not so they can cleverly code in system dependencies, but so that they can build working software.

Let me put it another way: if you woke up tomorrow and knew none of this, if you didn't know a registry from
a carriage return, would that make you a better Java programmer? Or are you better off understanding all this and more?

Russ Olsen

thread.rss_message