Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Run anywhere

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can execute a class file into a computer java 1.X not installed with it?
I mean, to run a class file you type in command promt the following:
java MyClassFile
but if jdk1.X not installed in the computer, the (java MyClassFile) will not recognize.
So, What it means compile once, run anywhere?
is it necessary to install JDK1.X?
thanks
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't, unless you have the Java Virtual Machine installed on the computer you want to run the class on.
COMPILE ONCE means the program is compiled into bytecode that is in a .class file.

'RUN ANYWHERE' means that a Java .class file will run on any machine PROVIDED that machine has the Java Virtual Machine installed on it.
Sun makes the JVM for many different platforms available for free download. It's called RTE, or Run-Time Environment, which among other things, contains the JVM.
The JVM just sits there doing nothing until you type 'java myclassfile' on the command line.
Cool, ain't it?
 
Steve Schowiak
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I forgot to mention:
The JDK or SDK is a download from Sun that will give you all the command-line tools to compile, run, document, and debug Java programs.
The RTE is a download that provides tools that work in the background when your web browser is running, so you can see applets and stuff. It also has the java command that lets you run class files from the command line.
The Sun 1 Studio is a seperate download that has a cool IDE in it. It includes the JDK/SDK.
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic