Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java program written in Solaris(.class file) to run in LINUX

 
Amod Kumar Singh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a java program written in Solaris i.e. the class file is to be transferred to Linux and required to run is there any changes that are required to be made
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

In general, no. .class files are portable to any Java virtual machine, on any platform. It's certainly possible to write Java code that will only run on some machines -- for instance, by hard-coding paths or other system-dependent information -- but otherwise, you can just copy the files and run them.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... Or, as the saying goes, "Write Once, Run Anywhere".

I believe that Sun has a set of specs that, if adhered to, are guaranteed to be portable. I don't remember the full set, but one obvious one is not to use external non-java libraries, and its converse: wherever possible, use the JVM-supplied standard classes (the "java.*" classes), as they were designed to implement functions without depending on a particular set of hardware or OS.

I have a project I'm trying to get rolling that specifically chose Java as its platform because I wanted to be not only OS and hardware-independent, but independent of the windowing system and window desktop software of the user's machine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic