Why Java is platform independent? And how to set path in Java?

Why Java is platform independent?

Because it's sometimes a very good thing to be able to write and run the same software on Windows/Linux/Mac.

And how to set path in Java?

That depends on which platform you are using (which demonstrates the practical limitations to complete platform independence!)

as to 'how is Java platform independent', since my guess is that's your actual question.
for each platform there is a different JRE, which handles the differences. so the code you write/compile, won't have to be re-compiled, you just need to have the right JRE installed on the system where you want to run your code, but you need that anyway if you want to run a Java application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.