This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes technical doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

technical doubt

hansika motwani
Ranch Hand

Joined: Jul 22, 2008
Posts: 44
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

Joined: Aug 05, 2005
Posts: 3432
    
  12
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.


Joanne
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

Hansika please UseAMeaningfulSubjectLine.
"technical doubt " isn't much descriptive.


SCJP, SCWCD.
|Asking Good Questions|
hansika motwani
Ranch Hand

Joined: Jul 22, 2008
Posts: 44
ya thank you sir ..for your reply .If necessary i will post some more queries
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38057
    
  22
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: technical doubt
 
Similar Threads
Is JDK same for all platforms(windows,unix,mac) or is it different for different operating systems.
Java Basics
platform-independent
core java doubt
core java query