i was just wondering when you compile your program you have a .class file, but when you goto run your program you are running the .java file, so what pupose does the .class file have ???
there must be some point though yeah ??
Printable View
i was just wondering when you compile your program you have a .class file, but when you goto run your program you are running the .java file, so what pupose does the .class file have ???
there must be some point though yeah ??
Actually, you are not running the .java file, you are running the .class file. The .java file is just the ASCII text source code. The .class file is the compiled code, like a .exe file.
:)
but surely it is the java file that you are running because to run it you type
java Something.java
and not
java Something.class
and there isn't any ascii code in the class file, well none that i saw ??
All you type is java Something not java Something.java. If you are using JDK that is. With JDK you compile with javac Something.java then to run you use java Something
oh yeah i forgot about that thanks, i am new to java btw :p
but still i can't see a use for the .class file
can you actualy compile a java program to an exe at all ??
if so how ?
I'm new to it also. I believe you need a 3rd party software to convert to exe. Unless Borland has something built into Jbuilder.
Yes there are apps to convert class files to exe's. I started a thread about that a while ago, I'll see if I can find it.
The reason that java files are compiled into class and not exe files, is because exe format is OS-dependant, and that would undermine the whole purpose behind Java's platform independence.
When you type in "java Something" the JVM kicks off and runs the class file. The JVM interprets the class file's code, and translates it to a form that the OS understands.
:)
Yeah, the class file is the byte code. It is then run by the VM.
ok then cheers guys :) :cool: