• Post Reply 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

core java query

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi every one .
iam nodding my head for one basic question which is about platform independency in java..I have 6 queries
1)let us assume i have compiled a java program on windows os (obiviously windows compatible jvm) .the moment i got my class file if i run that under linux os (linux compatible jvm). will i get same output (without any modificaitons)as i got in windows os..if yes will that happen for every topic in java as swings ,applets, awt and even graphics representation works.
2)when i used windows jvm and compiled the program how can a linux jvm can understand windows jvm compiled code and run that on linux jvm ?
3)i have devoloped a java decompiler under windows os and when i give class file as input iam getting same source code which has produced that class file .will i get the same source code if i took that windows compiled class file and run that under linux (os under linux jvm)?
4)if yes when compiling i have used windows jvm then how can i get same source code if i decompile it under linux os..how can a linux jvm can produce same source code being compiled under windows jvm ..then how one can say jvm is platform dependent..and jit compiler is also platform dependent ..
5)wora (write once run any where ) if i run class file under any os will i get same to same (100% same output ) as i got during windows os
6)till the process of class file creation will the jvm would be dependent on operating system.if yes then even when decompilation or while running the program how is it producing the same output ?
please please please help me and answers my queries with patience (please sir) please. please dont send me any link or url answer them please
thanks and regards to java ranch team
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This really sounds like homework.

Please take your time to study a bit and if you have remaining questions, ask them.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't use a JVM to compile java source code. You use it to run Java byte code produced by a Java compiler.

The JVM is different on each platform. A Windows JVM will not run on a Linux box. The JIT compiler is part of the JVM and is therefore platform dependent.
The byte code produced by the Java compiler will run on any JVM on any OS*.
In other words, the JVM is platform dependent, the java byte code is platform independent.*

I think that covers all the points you raised. Feel free to ask more questions in you're still uncertain if anything.


* It is possible to put some platform dependent code in Java source (e.g. running an OS command using ProcessBuilder), but in general byte code is platform independent.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by hansika motwani:
3)i have devoloped a java decompiler under windows os and when i give class file as input iam getting same source code which has produced that class file



I recommend you market this immediately. Apart from with the very simplest of code, I never found a Java decompiler that decompiles a class file to exactly the same source code as it was created with.
reply
    Bookmark Topic Watch Topic
  • New Topic