views:

243

answers:

5

Hi, I wanna know is it possible to make an operating like windows-xp which is written in C language like can I write that in java so that I will have same features as written in C

+10  A: 

In theory yes, but you'll still have to have some low-level assembly code to bootstrap the Java VM that will run on the machine, and also low-level code for accessing hardware drivers.

From wikipedia:

Given that Sun Microsystems' Java is today one of the most dominant object-oriented languages, it is no surprise that Java-based operating systems have been attempted. In this area, ideally, the kernel would consist of the bare minimum required to support a JVM. This is the only component of such an operating system that would have to be written in a language other than Java. Built upon that JVM and basic hardware support, it would be possible to write the rest of the operating system in Java; even parts of the system that are more traditionally written in a lower-level language such as C, for example device drivers, can be written in Java.

Examples of attempts at such an operating system include JX, JNode and JavaOS.

Eli Bendersky
A: 

It depends on what you consider "features". If you mean graphical interface, fancy window effects, etc. then yes, although you will need assembly language or C for the very lowest bits (i.e., interfacing with I/O ports, etc.). If you also include the Windows ABIs as a feature then it gets harder since they follow Pascal calling conventions.

Ignacio Vazquez-Abrams
Windows API's are not a necessary part of an operating system.
Thorbjørn Ravn Andersen
A: 

In theory, yes. But you would need to somehow get the Java VM running using low-level code (unless you want to compile Java down to assembly, which probably isn't possible without sacrificing a lot of Java's features).

Ron Gejman
Eli beat me to roughly the same answer...
Ron Gejman
Jikes RVM (formerly IBM Jalapeno) and Sun Lab's Maxine are two examples of self-hosting JVMs. The former has around 1000 lines of C. Java is usually compiled down to machine code.
Tom Hawtin - tackline
+3  A: 

http://www.jnode.org

sesteel
Here is one more. http://sourceforge.net/projects/jos/ . But I second what Eli Bendersky and Ron Gejman say.
Christy John
A: 

operation systems are closer to the hardware (like drivers). in my view this it not the area of Java (just the wrong solution of the problem domain operating-system).

manuel aldana