GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Java Basics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java Basics" Watch "Java Basics" New topic
Author

Java Basics

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
As we say , after compilation of java code, bytecode is generated.

In this context, what is JVM and bytecode?


kunal
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11356
    
  16

Java bytecode is a special language that the Java Virtual Machine (JVM) understands. The JVM is basically a program that knows how to read bytecode and talk to a specific operating system/platform. So, there is a JVM for windows XP, a JVM for linux, a JVM for Mac OS.10, etc.

You can give the exact same .class file (which is bytecode) to any JVM, and it will interpret it for the machine where it runs.

this is vastly different from something like C. You'd need to compile your C code for each platform, and make sure you sent the correct (set of) file(s) for that OS. That often lead to maintenance nightmares.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
we say java is a secure language. Is this bytecode concept related to java security?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11356
    
  16

no.
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
So, what makes java a secure language?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18876
    
  40

Kunal Lakhani wrote:So, what makes java a secure language?


No easy answer. Java is secure due to many components; from the byte code verifier, the class loaders, the security manager, and how many of the classes are designed and behave (immutability, etc.).

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14194
    
  20

Kunal Lakhani wrote:As we say , after compilation of java code, bytecode is generated.

In this context, what is JVM and bytecode?

The following page in Oracle's Java Tutorials explains these basic principles: About the Java Technology.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
GeeCON Prague 2014
 
subject: Java Basics