Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Java (programming language)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Java JVM and bytecode === {{Main|Java (software platform)|Java virtual machine}} <!-- we apparently have two main sections for what seems to be the same thing. Merge needed? --> One design goal of Java is [[software portability|portability]], which means that programs written for the Java platform must run similarly on any combination of hardware and operating system with adequate run time support. This is achieved by compiling the Java language code to an intermediate representation called [[Java bytecode]], instead of directly to architecture-specific [[machine code]]. Java bytecode instructions are analogous to machine code, but they are intended to be executed by a [[virtual machine]] (VM) written specifically for the host hardware. [[End user|End-users]] commonly use a [[Java virtual machine|Java Runtime Environment]] (JRE) installed on their device for standalone Java applications or a web browser for [[Java applet]]s. Standard libraries provide a generic way to access host-specific features such as graphics, [[thread (computing)|threading]], and [[Computer network|networking]]. The use of universal bytecode makes porting simple. However, the overhead of [[Interpreter (computing)|interpreting]] bytecode into machine instructions made interpreted programs almost always run more slowly than native [[executable]]s. [[Just-in-time compilation|Just-in-time]] (JIT) compilers that compile byte-codes to machine code during runtime were introduced from an early stage. Java's Hotspot compiler is actually two compilers in one; and with [[GraalVM]] (included in e.g. Java 11, but removed as of Java 16) allowing [[tiered compilation]].<ref>{{Cite web |date=2021-08-06 |title=Deep Dive Into the New Java JIT Compiler β Graal {{!}} Baeldung |url=https://www.baeldung.com/graal-java-jit-compiler |access-date=2021-10-13 |website=www.baeldung.com |language=en-US |archive-date=October 28, 2021 |archive-url=https://web.archive.org/web/20211028165746/https://www.baeldung.com/graal-java-jit-compiler |url-status=live }}</ref> Java itself is platform-independent and is adapted to the particular platform it is to run on by a [[Java virtual machine]] (JVM), which translates the [[Java bytecode]] into the platform's machine language.<ref>{{cite web|url=http://www.programmerinterview.com/index.php/java-questions/jvm-platform-dependent/|title=Is the JVM (Java Virtual Machine) platform dependent or platform independent? What is the advantage of using the JVM, and having Java be a translated language?|publisher=Programmer Interview|access-date=2015-01-19|archive-url=https://web.archive.org/web/20150119144223/http://www.programmerinterview.com/index.php/java-questions/jvm-platform-dependent/ |archive-date=January 19, 2015|url-status=live}}</ref> ==== Performance ==== {{Main|Java performance}} Programs written in Java have a reputation for being slower and requiring more memory than those written in [[C++]].<ref name=Jelovic>{{cite web |title=Why Java will always be slower than C++ |last=Jelovic |first=Dejan |url=http://www.jelovic.com/articles/why_java_is_slow.htm |access-date=2008-02-15 |url-status=dead |archive-url=https://web.archive.org/web/20080211111923/http://www.jelovic.com/articles/why_java_is_slow.htm |archive-date=February 11, 2008}}</ref><ref>{{cite web |last=Hundt |first=Robert |title=Loop Recognition in C++/Java/Go/Scala |url=https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf |access-date=2012-07-12 |url-status=live |archive-url=https://web.archive.org/web/20111116151424/https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf |archive-date=November 16, 2011}}</ref> However, Java programs' execution speed improved significantly with the introduction of [[just-in-time compilation]] in 1997/1998 for [[Java version history|Java 1.1]],<ref>{{cite web |url=http://www.symantec.com/about/news/release/article.jsp?prid=19970407_03 |title=Symantec's Just-In-Time Java Compiler To Be Integrated into Sun JDK 1.1 |access-date=August 1, 2009 |archive-url=https://web.archive.org/web/20100628171748/http://www.symantec.com/about/news/release/article.jsp?prid=19970407_03 |archive-date=June 28, 2010 |url-status=dead}}</ref> the addition of language features supporting better code analysis (such as inner classes, the StringBuilder class, optional assertions, etc.), and optimizations in the Java virtual machine, such as [[HotSpot (virtual machine)|HotSpot]] becoming Sun's default JVM in 2000. With Java 1.5, the performance was improved with the addition of the {{code|java.util.concurrent}} package, including [[lock-free]] implementations of the [[Java ConcurrentMap|ConcurrentMaps]] and other multi-core collections, and it was improved further with Java 1.6.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)