Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes Unix + Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Unix + Java" Watch "Unix + Java" New topic

Unix + Java

bobby reddy

Joined: Nov 05, 2007
Posts: 27
Hello everyone,
Could anyone let me know why Unix is used in combination with Java?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33118

UNIX is an operating system. Java runs on an operating system. Java can run on UNIX (or Windows or Mac or Linux or ...)

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
bobby reddy

Joined: Nov 05, 2007
Posts: 27
Hello Jeanne Boyarsky,
Whats the difference in the Java application that makes use of Unix or Windows operating system?
Can the same Java application work on two different OS?

Matt Gaunt
Ranch Hand

Joined: Sep 05, 2003
Posts: 34
Hi Bobby,

A java application, once written and tested can be run on both a UNIX and Windows operating system. You do not have to alter the code for it to work for different environments.


Matt Gaunt
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

There are some caveats to that. it is certainly possible to write some java code that IS system dependent, but this usually means you've used some non-standard classes/packages.

You can also write your java to make system calls (i.e. call a program that the OS runs... i.e. on windows, you could call 'dir' to list the files) which would not work across platforms.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
marc weber

Joined: Aug 31, 2004
Posts: 11343

Originally posted by bobby reddy:
...Can the same Java application work on two different OS? ...

Absolutely. This is the idea behind compile once and run anywhere.

The thing is: The different platforms must be running their own (OS-specific) Java Virtual Machine (JVM). This is what allows the same compiled bytecode to run on different platforms. As pointed out, JVMs can run on Windows, Mac, Linux...

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
camilo lopes
Ranch Hand

Joined: Aug 08, 2007
Posts: 202
for examples:
Delphi not run in all operation system. Today he give support there are some system as a unix.
Java run independent of the plataform that you use. can be unix, mac, windows. not is necessary move one line of the code for this.

Brazil - Sun Certified Java Programmer - SCJP 5 About Java - Update every Week.
Guide SCJP - tips that you need know
I agree. Here's the link:
subject: Unix + Java
It's not a secret anymore!