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
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?
I am not insane. The voices in my head told me so.
Joined: Oct 21, 2002
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.