Bookmark Topic Watch Topic
  • New Topic

technical doubt

 
hansika motwani
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Report post to moderator
Dear sir
Thanks for your reply sir ..but still few more questions have to be cleared sir ..



1) I do know that class file contains byte code and it can be runned under any operating system ..but sir if i compile one java program under windows os(windows jvm) ill get class file if i run that under linux os(linux jvm) will the linux jvm can come to know that this file is being compiled on windows operating system??

and will it convert that class file to linux compatible one and then the output can be seen or will it directly run that without bothering about the operating system it has come from ?


2)sir you are saying that class file is common for all operating systems .does that mean if i write addition of 2 no's under windows and linux and sun solaris ..the 3 class files which i get are one and same even in bytes ...?

3)while devoloping java decompiler if i use any system calls which are related to operating system ..if i run that under different os then how can it produce source code of linux ?(when i used windows related system calls)

4) Though the byte code which jvm understands is universal..will the appearance of the output would differ if run that on different operating systems ..


with regards
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Report post to moderator
I assume we are carrying on this conversation. It would have been better to carry on there. Starting a new thread makes it difficult for people to know what has already been discussed.

1. As far as I know, there is no way to tell from a class file which operating system it was created on. Assuming they are targeting the same JVM version, then theoretically, all compilers will create identical byte code if given the same source code (there may be exceptions to this in cases where the same functionality could be implemented in byte code in different ways).

2. Theoretically yes. See above.

3. If you make a system call in your program to (say) notepad.exe, then on the Linux system it will also try to execute notepad.exe. As notepad.exe doesn't exist on Linux, the call will fail. The byte code is doing exactly the same thing on both systems - it's only the outcome that is different.

4. It's possible that the output of a program could be different on different OSs. Swing is a good example of this. The default Look And Feel is different on Windows from what it is on Linux so a Swing program could appear differently.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hansika please UseAMeaningfulSubjectLine.
"technical doubt " isn't much descriptive.
 
hansika motwani
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Report post to moderator
ya thank you sir ..for your reply .If necessary i will post some more queries
 
Campbell Ritchie
Sheriff
Pie
Posts: 50278
80
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by hansika motwani:
ya thank you sir ..for your reply .If necessary i will post some more queries
Please don't call Joanne Neal "Sir."

If you are posting questions related to the original thread, it would be better (as Joanne has already told you) to put them on the original thread. Since you have got an answer to your present question, and to avoid duplicate conversations (please look at this FAQ) I am closing this thread.
 
    Bookmark Topic Watch Topic
  • New Topic