Why JAVA is platform independent?

seoways

Elite Member
Jr. VIP
Joined
Dec 19, 2009
Messages
7,630
Reaction score
3,070
Java is said to be platform independent. Because, all the java codes will be running on JVM (Java Virtual Machine) where as c and c++ are depends on the operating system. First the JIT (Just in Time) compiler convert the program into byte code (that is .class file) once you compile it on JVM.
The byte code has the capability to run on any operating system if OS has JVM.
So, Java is definitely Platform Independent Language.
 
because for example C#/VB and etc.. require certain libraries and dependancies to be installed on your OS upfront. While Java requires no outside dependancies and libs except the ones in the JVM
 
You didnt answer why at all.

Simply:

To fulfil a dream of "write once, run anywhere"
 
You didnt answer why at all.

Simply:

To fulfil a dream of "write once, run anywhere"
Java mainly concentrates on security and compatibility purpose. In Java there is no need to fetch the physical memory so, it is more secure than other languages. Though there are many language, java is considered as a secure language. Moreover Android is based on java program.
 
Last edited:
The "platform" here means computer type - mac, pc, nokia mobile phone (yes, this is a computer too); and also operating system - windows, linux, and so on.
if you write an "application" or a script in java, any of these systems can run it and it will more or less look and work exactly the same.
this is because java program is actually not run directly by the computer as a for example .exe application, but "interpreted" by so called JVM (java virtual machine) - a robot application which was already installed in the computer beforehand.
thus it is not "dependent" on what computer you have.
 
So what's the point here?
So, if you really need to do secure and compatible program just switch to JAVA!!!
Just know the use of .class file (hexadecimal) which can in run any platform.
 
All I know is that it has more updates than a Dragon Ball Z villain...

Final-Form.jpg
 
So, if you really need to do secure and compatible program just switch to JAVA!!!
Just know the use of .class file (hexadecimal) which can in run any platform.

I already use Java, thanks for the tip though. :)
 
well c and c++ are not dependable on the OS if you write portable code. Of course you will need to compile it, but they are way faster than java.
 
Java mainly concentrates on security and compatibility purpose. In Java there is no need to fetch the physical memory so, it is more secure than other languages. Though there are many language, java is considered as a secure language. Moreover Android is based on java program.


Thanks for the heads up :-)

I must have somehow missed the point of Java through my ComSci MSc and my 10 years as a {C|C++|Java/...} developer and consultant
 
Java is not compatible "as is", code have to be also compatible. If you wrote your code, to use some Windows typical features, like desktop directory etc. it will not be portable.

There is very large number of things that you can make and these things will not be portable - like GUI application - can run on windows and unix, but not on Android.

Compatibility means that you don't have to re-compile your code for every platform and, you don't have think about some hardware or OS-spec things like "is this number 32 or 64bits long? in which order are bytes of integer send by network?" etc. etc.

Also using Java dosen't guarantee you security - you must write code in secure way, think about potentialy dangerous usages/hacks of your software.
 
So, if you really need to do secure and compatible program just switch to JAVA!!!
Just know the use of .class file (hexadecimal) which can in run any platform.

I'm not sure what planet you are from but it definitely isn't Earth.
 
Java is said to be platform independent. Because, all the java codes will be running on JVM (Java Virtual Machine) where as c and c++ are depends on the operating system. First the JIT (Just in Time) compiler convert the program into byte code (that is .class file) once you compile it on JVM.
The byte code has the capability to run on any operating system if OS has JVM.
So, Java is definitely Platform Independent Language.

I learn so much here from noobs.... NOT!!

Java is compiled into bytecode. A JIT compiler compiles the bytecode into JVM executable machine code. I'm not about to dig any deeper... Java is platform independent for the same reason ionCube PHP is independent LOL. Bytecode is bytecode, and although it isn't source, it isn't fully compiled code either.

So (adding something to the thread...) what are the current Java issues:


Security

The Java platform provides a security architecture which is designed to allow the user to run untrusted bytecode in a "sandboxed" manner to protect against malicious or poorly written software. This "sandboxing" feature is intended to protect the user by restricting access to certain platform features and APIs which could be exploited by malware, such as accessing the local filesystem, running arbitrary commands, or accessing communication networks.

In recent years, researchers have discovered numerous security flaws in some widely used Java implementations, including Oracle's, which allow untrusted code to bypass the sandboxing mechanism, exposing users to malicious attacks. These flaws affect only Java applications which execute arbitrary untrusted bytecode, such as web browser plugins that run Java applets downloaded from public websites. Applications where the user trusts, and has full control over, all Java code being executed are unaffected.

On August 31, 2012, Java 6 and 7 on Microsoft Windows, Mac OS X, and Linux were found to have a serious security flaw that allowed a remote exploit to take place by simply loading a malicious web page. Java 5 was later found to be flawed as well.

On January 10, 2013, three computer specialists spoke out against Java, telling Reuters that it was not secure and that people should disable Java. Jaime Blasco, Labs Manager with AlienVault Labs stated that "Java is a mess. It?s not secure. You have to disable it."This vulnerability affects Java 7 and it is unclear if it affects Java 6, so it is suggested that consumers disable it. Security alerts from Oracle announce schedules of critical security-related patches to Java.

On January 14, 2013, security experts said that the update still failed to protect PCs from attack. This exploit hole prompted a response from the United States Department of Homeland Security encouraging users to disable or uninstall Java. Apple blacklisted Java in limited order for all computers running its Mac OS X operating system through a virus protection program.
 
Back
Top