• Register
0 votes
1.8k views

Problem :

I am beginner to Java. I have one doubt about Java Compilers as below.

For compiling a java code we have separate compilers for different os.”

Can someone answer my question?

8 4 2
2,300 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I have gone through your question. Almost everybody who is new to Java has this doubt. The JDK consists of compiler and JVM.

The Compiler will compile java file it means it will convert a .java file to a .class file. As .class file is completely platform independent it means compiled class file of your java file will be the same for all Operating Systems so  from the algorithmic perspective we can say that the compiler is same across all the platforms. As it is the executable file so the file itself will be different for Windows  it will be .exe and for Linux it will be Linux executable etc.

Now the JVM converts bytecode  i.e our .class file  to the 'system specific' code. As the system specific code is dependent on its OS. So from the algorithmic point of view the JVM is different across all OS. Also the actual file will also be completely different on different OS.

I hope now you are clear about Java Compiler.

5 2 1
4,980 points

Related questions

0 votes
1 answer 16 views
16 views
Problem: Can someone answer my question: For compiling a java code we have separate compilers for different os .
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 1 view
1 view
Problem: I'm wondering one thing, which is that, is that machine code specific to every different operating system? Is it necessary to write a different compiler for the same language on Mac, Windows and Linux operating systems? Please elaborate if the answer is yes, no or in between.
asked 3 days ago Supti 12.7k points
1 vote
1 answer 19 views
19 views
Problem: I am unable to find out the solution, Please solve it : unsafe code may only appear if compiling with /unsafe
asked Mar 15 MUHAMMAD MUNEEB 83k points
0 votes
1 answer 7 views
7 views
Problem: Can anyone me with this question. Compare and contrast compilers from interpreters.
asked Apr 8 nabin shrestha 4.3k points
1 vote
2 answers 375 views
375 views
Problem: Dear all, Right now I’ve imported a maven project into my eclipse IDE and I changed my java path library to work on java 1.7 Suddenly, eclipse started showing an error but I’ve got no errors in my files there. The error is “java compiler level ... Project Problem (Java Version Mismatch) Please tell me how to resolve this error (I want to have my JRE version as 1.7 only).
asked Mar 22, 2020 Gavin 15.3k points
0 votes
1 answer 1 view
1 view
Problem: I am getting the following exception repeatedly each time I try to run the program. Error occurred during initialization of VM.Could not reserve enough space for object heap. Could not create the Java virtual machine.I tried to increase my virtual memory (page size) and RAM size, but to no avail.How can I eliminate this error?
asked 2 days ago Humaira ahmed 50.7k points
1 vote
1 answer 5 views
5 views
Problem: My Java 7 is giving me an error: Minecraft could not reserve enough space for object heap.
asked Apr 26 PkGuy 23.5k points
0 votes
1 answer 4 views
4 views
Problem: I am getting the following exception repeatedly each time I try to run the program. Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine. I tried to increase my virtual memory (page size) and RAM size, but to no avail. How can I eliminate this error?
asked Apr 23 Yeamin 21.4k points
0 votes
1 answer 189 views
189 views
Problem : I am having a box with 8gb of ram, so I don't think the total memory is the issue. This application is running properly on boxes with 6gb or less ram. What I am trying to do is to reserve 3GB of space using -Xmx3G command under "VM ... : Error occurred during initialization of VM; Could not reserve enough space for object heap using -Xmx3G Why am I getting such error any clue?
asked Nov 26, 2019 alecxe 7.5k points
0 votes
1 answer 5 views
5 views
Problem: How to solve this: Is it possible to save C# code fragments to a text file?
asked Mar 19 Wafa Abu Yousef 6.1k points