Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

technical doubt

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
ya thank you sir ..for your reply .If necessary i will post some more queries
 
Marshal
Posts: 80123
416
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
    Bookmark Topic Watch Topic
  • New Topic