• Register
0 votes

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 119 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
1 vote
2 answers 209 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 9 views
9 views asked Sep 22, 2020 miki 1.9k points
0 votes
2 answers 22 views
Is it possible to dynamically compile and execute C# code fragments?
asked Aug 28, 2020 Aliza313 720 points
1 vote
1 answer 1.9K views
Problem: I am a windows seven user and recently I’ve installed JDK to learn java but I am getting an error. The message is something like: Missing server JVM at `C:\Program Files\Java\jre7\bin\server\jvm­­.dll' please install or use the JRE or JDK that contains these missing components. Your kind solution is much appreciated.
asked Mar 22, 2020 Gavin 15.3k points
0 votes
1 answer 1.4K views
Problem : I had to run the jmap so that I can take the heap dump of my process. But the jvm returned below error : Unable to open socket file: target process not responding or HotSpot VM not loaded The -F option can be used when the target process is not responding So I ... to take the heap dump? 2. I am waiting for more than 20 minutes and not finished yet. Any ideas why it is taking so long?
asked Dec 19, 2019 alecxe 7.5k points
0 votes
1 answer 15 views
I want to add a "window.location.href = 'http://site.com'" at a particular location in my C# functions so that is gets ignored by the C# compiler but gets passed into the converted Javascript. I could edit the resulting Javascript after it's converted however but that can become cumbersome. Maybe some type of code annotations?
asked Sep 17, 2020 Sofi55 1.1k points
0 votes
0 answers 27 views
Problem: Which one of the following would contain the translated Java byte code for a program named Demo? A) Demo.java B) Demo.code C) Demo.class D) Demo.byte
asked Jul 23, 2020 conner 1.5k points
0 votes
1 answer 13 views
Explain with an Example?
asked Sep 24, 2020 jagruthi 680 points
0 votes
1 answer 6 views
Problem: Hello! I recently attempted a quiz on programming, which was required for an internship. I do not have much experience in the field of computer programming. There was a question in the quiz that puzzled me: “A java program must have at least one ... c. Could anyone from here please tell me whether my answer was correct or not. Moreover, please explain the correct answer. Thanks!
asked 1 day ago Code Learner 5.2k points