Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java vs .net

  Asked By: Adelina    Date: Jul 30    Category: Java    Views: 1078

please tell me what is the basic difference between java and .net
which makes .net little forword tahan j2ee nowadays.



4 Answers Found

Answer #1    Answered By: Zachary Larson     Answered On: Jul 30

J2EE is platform independent, .NET is not
.NET offers language-independence and language-interoperability, J2EE
does but is not being practised.


Answer #2    Answered By: Russell Burns     Answered On: Jul 30

Java has created a new wave in the programming
world, by introducing the
concept of managed execution. And it succeeded in what
it was created for. A
managed program means that all the memory needs of the
application are
handled by the platform itself. A platform means
anything over which the
program runs. Suppose a program is designed for intel
processors, it uses
the assembly language or opcodes which are designed
and are used by that
particular processor itself, so the program is running
on intel platform.
Samething applies to windows platform or Linux
platform or Java Platform or
.Net platform. As the program is managed, the
advantage of the application
is that it can be ran over any OS, because there is
little or no need to
interact with the base operating system, when you
program with Java. Even
.NET is designed in a platform independent way and it
is also a managed
environment. But for programs, designed in any managed
environment, to run
on any OS, there must be a runtime environment that
takes care of converting
what you programmed to what the system understands.
For thise Java uses Java
Runtime Environment(JRE). and .NET uses .NET Runtime
Environment. But JRE is
there on several different Operating Systems,
implemented by either Sun
Microsystems itself or other companies. But .NET
runtime is there only on
Windows Operating System, so people say that .NET is
not platform
independent. Infact there are some open source
implementations going on to
develop .NET for other platforms, like Mono for Unix
And another major difference  between Java and .NET
is that Java converts
Java source code into object code, which infact suits
for Java programming
language itself. .NET on the other hand converts
source code into IL
(Intermediate Language). This is somewhat similar to
Assembly language, but
it is not a low level language. This IL gives .NET a
major advantage. Any
compiler can be developed that can convert whatever
source code into IL. So
the result is that many languages can be used on .NET
platform, not
restricting to any single language. Therefore, there
are C#, J#, VB.NET,
VC++.NET, etc., And the result is Language
Independence. You can program on
any language that you want for which a .NET compiler
exists. And one more
advantage is that a library, if carefully designed can
be used by any
language on .NET platform. So if you design a new
compiler that supports
.NET, then whole .NET library can be used by the
programs developed by
people using your compiler. This makes .NET a good
platform. And moreover
.NET is more flexible then Java, interms of
programming. It's not that a
particular thing can't be programmed in Java, but
there are many things in
.NET that reduce the amount of code that you need to
write if you are using
Java. And Java always had a badname that it uses
naming of variables, which
are confusing. .NET is designed after studying the
weak points of Java, so
.NET has edge over Java on this Issue.
The first and foremost thing that gives Java an
edge over .NET is that
it is platform independent. And Java is already
available on many platforms
and it is installed on many desktops also. So the
program that you might or
already developed, will be used many people than if it
is designed using
.NET. Java is there since 9 years, and it is well
developed since then and
is used alot since it is designed. Java is well tested
and has been used in
various fields, so if you employ Java, it is quite
sure that you will get
some help anywhere. And another thing is that Java is
opensource and is
free. ofcourse .NET is also free, but there are a
number of free IDE's for
Java like NetBeans, that are as good as Visual
Studio.NET and are also free.
And Java can be used on Linux, which is free. so on
overall basis, for using
Java, you just need to buy hardware and everything
else is free. For .NET,
there are some free good IDE's but not as good as
Visual Studio.NET which is
unbeatable, but comes at a price, a heavy price
indeed. And moreover, .NET
has been there since 2001 only, and it needs somemore
time for people to
really install .NET runtime on there systems, and
developers like you to use
And if you ask me, whether you like Java or .NET,
I personally like .NET
(may be you saw that inclination in my text). Anyway I
think I answered what
you asked. Hope you understood.

Answer #3    Answered By: Louis Mason     Answered On: Jul 30

I would like to state my views on couple of points mentioned on this thread.

1) It is generally claimed by Microsoft that any language can be made to
produce IL code and thus .NET has many languages compared to java  that
has only one language. This is only partly true because of the following
i) Same can be done with java also, if the specifications for java byte
code are available. ( I don't know if they are). This isn't something
revolutionary about .NET
ii) Languages sometimes have to be heavily modified so as to make them
compatible with the .NET platform. Take VB for example. There is hell
lot of a difference  between vb 6 and vb.net. In fact vb.net is like
learning a new language. The only advantage you might have is *some*
similarity in the syntax between the original language and .NET
compatible language. And some languages can't produce IL code at all if
they aren't strongly typed like java script, vb script.

2) another advantage claimed by .NET is that is uses JIT compiler. JIT
compilers are also (freely) available for java.

Answer #4    Answered By: Hehet Chalthoum     Answered On: Jul 30

You are right that if Java's byte code specification is there, we can
develop a compiler for some other language over Java platform also. But Java's
bytecode is just suitable for Java language. For example, Microsoft .NET's IL is
a separate language, you can even program using that, and that language has got
many more features than you might have expected, it supports a lot, but any .NET
compiler only uses a subset of those features, for example, MS.NET IL is capable
of providing operator overloading, this is used by C# but J# does n't use that,
so it is fair to call ..NET is Language independent.
Yes languages needed to be modified, for them to be compatible with .NET
platform, but take the case of some language like Perl, it is a good programming
language but it has no available libraries, at least not as many as C or C++
has, if the developers of Perl made small changes such that it is compatible
with .NET platform, then you see whole .NET library can be used by Perl
developers, what else they want. It is a common problem for man, to lose
something to gain something, but the thing gained in this case is far more
valuer than the thing lost.
And regarding your view about ..NET's JIT compiler. yes there are many free
JIT compilers for Java also, even the JRE has that facility, but the facilities
offered by .NET's JIT are not offered by any of the Java JIT compilers. .NET's
JIT can save the code once compiled, in memory and then use the same compiled
code, when the same sort of code is found. And also, .NET's has a facility to
save the Native compiled code in a file so that when the program is running,
that compiled code is used instead of compiling again, making the program run at
full speed.

.NET is a good platform, it has got everything Java has and a lot more. And
for everybody in this group who are expecting me to be somewhere related to
Microsoft, Iam a pure Java developer, and has n't even developed a single
program on .NET platform.

Didn't find what you were looking for? Find more on java vs .net Or get search suggestion and latest updates.