I have read that JVM is an interpreter.
why it is not a compiler?(I think compiler can fast with bytecode in java.Why they wanna interpreter to do it step by step )
what is the use of it? (why the java language makers did not made it as a compiler)
In most language I heard that they got compilers.
can any one give me a little help on this.No need to be much complex
Why JVM is an Interpreter
Re: Why JVM is an Interpreter
There is a small help for your question http://en.m.wikipedia.org/wiki/Java_(pr ... _language)
[ Post made via Mobile Device ]
[ Post made via Mobile Device ]
Re: Why JVM is an Interpreter
Technically, Java is not a fully interpreted language. It is called a hybrid language. If I elaborate it further, Java has both the functionality of a compiler and an interpreter.I have read that JVM is an interpreter.
why it is not a compiler?
First Java compiled a Java source code to an intermediate code called bytecode using a the Java compiler commonly known javac. This byte code is the machine code for Java Virtual Machine. So when we run a Java compiled program, what JVM does is, take each instruction from bytecode and execute on the actual machine using interpreting or JIT compiling (Just In-time Compiler). So you must be clear that Java has both the functionality of a compiler (javac) and an interpreter (JVM). However, JIT compiling (not interpreting) is used in most JVMs today to achieve greater speed. There are also ahead-of-time compilers that enable developers to precompile class files into native code for particular platforms.
FYI: You know there are several processing architectures. RISC and CISC are common. There is another architecture called Push-Pop (Or Stack based). Java Virtual Machine is a virtual processor with Push-Pop architecture. At the time of uni, I have decompiled the bytecode for a 4th year assignment. It was fun
FYI: Java developers first planned to release JVM as a chip (additional microprocessor) which will come with every motherboard. Read PicoJava. Obviously it became a failure since no one has agreed to fix that for an additional cost. Note that some ARM processors can execute Java directly. Read Jazelle. I guess this is why Android run only on ARM (as a mobile platform).
The point is this. One of the main aims of Java is to make a language which can be run in any platform without recompiling. This is why Java can state it is Platform Independent.I think compiler can fast with bytecode in java.Why they wanna interpreter to do it step by step )
what is the use of it? (why the java language makers did not made it as a compiler)
If you use a classic compiler, it compiles the code to machine instructions of the current machine. There is no guarantee that it will get executed on another Operating System. For example: You can't run EXE files directly under Linux. You will have to recompile your code. Java answers this problem. You can run a compiled Java code in any platform with a JVM implementation (I guess almost all major platforms now have a JVM).
So it is clear that though compiled languages are father, those can't be run in other platforms (OSs). I guess I answered your question.
Actually most languages you find today are hybrid just as Java.In most language I heard that they got compilers.
can any one give me a little help on this.No need to be much complex
If you take all the languages in .Net platform, all are hybrid just as Java. .Net framework is the one which acts like JVM. Once the .Net framework is ready on Linux, people will be able to run those .Net compiled codes in Linux without recompiling.
Re: Why JVM is an Interpreter
Neo wrote:Technically, Java is not a fully interpreted language. It is called a hybrid language. If I elaborate it further, Java has both the functionality of a compiler and an interpreter.I have read that JVM is an interpreter.
why it is not a compiler?
First Java compiled a Java source code to an intermediate code called bytecode using a the Java compiler commonly known as Java JIT (Just In-time Compiler). This byte code is the machine code for Java Virtual Machine. So when we run a Java compiled program, what JVM does is, take each instruction from bytecode and execute on the actual machine. So you must be clear that Java has both the functionality of a compiler (Java JIT) and an interpreter (JVM).
FYI: You know there are several processing architectures. RISC and CISC are common. There is another architecture called Push-Pop. Java Virtual Machine is a virtual processor with Push-Pop architecture. At the time of uni, I have decompiled the bytecode for a 4th year assignment. It was fun
FYI: Java developers first planned to release JVM as a chip (additional microprocessor) which will come with every motherboard. Read PicoJava. Obviously it became a failure since no one has agreed to fix that for an additional cost. Note that some ARM processors can execute Java directly. Read Jazelle. I guess this is why Android run only on ARM (as a mobile platform).
The point is this. One of the main aims of Java is to make a language which can be run in any platform without recompiling. This is why Java can state it is Platform Independent.I think compiler can fast with bytecode in java.Why they wanna interpreter to do it step by step )
what is the use of it? (why the java language makers did not made it as a compiler)
If you use a classic compiler, it compiles the code to machine instructions of the current machine. There is no guarantee that it will get executed on another Operating System. For example: You can't run EXE files directly under Linux. You will have to recompile your code. Java answers this problem. You can run a compiled Java code in any platform with a JVM implementation (I guess almost all major platforms now have a JVM).
So it is clear that though compiled languages are father, those can't be run in other platforms (OSs). I guess I answered your question.
Actually most languages you find today are hybrid just as Java.In most language I heard that they got compilers.
can any one give me a little help on this.No need to be much complex
If you take all the languages in .Net platform, all are hybrid just as Java. .Net framework is the one which acts like JVM. Once the .Net framework is ready on Linux, people will be able to run those .Net compiled codes in Linux without recompiling.
I think .net is bit hard to use in Linux. One time i searched for the .net framework for Linux I found this http://www.mono-project.com/Main_PageIf you take all the languages in .Net platform, all are hybrid just as Java. .Net framework is the one which acts like JVM. Once the .Net framework is ready on Linux, people will be able to run those .Net compiled codes in Linux without recompiling.
But according to forums posts i saw about that. It can't run just as in Windows and it's not working well like .net working on Windows.