Exactly what the title said.
What is a .class file and how do you make them?
Printable View
Exactly what the title said.
What is a .class file and how do you make them?
It is the "binary" file which is created when you compile a .java file. It is read by the Java interpreter for your operating system to "run" the functionality coded in that file.
Java creates .class files automatically when it compiles a .java file. The class file is the code needed to run the program.
say your source file is = Test.java
Test.java --> run it through compilaer [javac] --> Test.class i.e. byte code --> runs on a JVM (Java Virtual Machine) run it with java command --> JVM converts the byte code to native code.
Hi friends,
Yes very true as you are saying, I just want to add some info -
.java - file is source file of any Java Program
.class - file is "Byte Code" which is platform independant.
.java file is compiled javac compiler
|
It creates byte code that is '.class' file
|
to run this .class file we need JVM installed
in machine(JVM is different in platform to platform)
|
Java Virtual Machine (JVM) interpret .class file
and give the output.
Thanks n Cheers,
Rohan Chandane
Thanks, that helps alot, so where would I find this javac compilier then? :D
visit http://java.sun.com
To develop with java, you need to install the java software development kit, also called jsdk or j2se. if you want to make the experience to compile the code by hand through the command line, you can install it and go to the installation folder (eg c:\j2sdk1.5). There is the folder bin including the executable javac.exe.
Usually java coder's don't messup with javac. Instead they use an integrated development environment (IDE) which also includes a text-editor with syntax highlighting. such an easy to use ide you can find at http://java.sun.com/j2se/1.5.0/download.jsp, it's called netbeans. a more complex ide is eclipse, the non plus ultra of java development.
Iv already got that software. Ill take a look at javac.exe. Do any of you have any info on Java Studio Creator 2. I cant seem to work it out. :confused:
If you are looking for a Java IDE, look at NetBeans. I like it, a lot. Much more logically organized for me and my use than Eclipse is.
HOWEVER
I continue to be convinced that it is better for you to learn "at the command line", using text processor created .java files, javac to compile, and java to execute ... Having everything work because of your choices rather than on the IDE's choices is the best way to understand the environment.
i am cent percant agreed with nspils. to learn java it is very best idea to write the code in notepad and then on command line using javac to compile and java to execute.
when u think that u are now at some experties level then it is better for you to work on any java ide. e.g for three years i worked on command line processor. now i think that i m on intermediate level. now i have started develpoment on jbuilderX IDE.
Regards,
Nomaan.
I totally agree, however, setting up that command line environment on a WIndows system seems to be beyond my current understanding. Even after loading Net Beans a search of my hard disk did not yield the location of a "javac.exe". Anybody know how I can obtain a javac compiler without all the IDE extras?Quote:
Originally Posted by nspils
What I simply want to do is create a "Hello World" applet I can include in a simple web page and actually get it to work. I've found 50 "hello world" java programs all looking about the same. The few variations I've tried, I got zero to work. I assume I need a javac compiler to actually make progress. But, maybe not?? Does anyone have A, B, C steps to make it happen?
Visit this site, download the "JDK 5.0 update 6"
http://java.sun.com/j2se/1.5.0/download.jsp
That's the web page that started the problem for meQuote:
Originally Posted by nspils
I downloaded both the NetBeans and the none netBeans versions. If the javac compiler is actually in all that mess will you please tell me the location? My PC search under windows says there is nothing on my pc called 'javac.exe'HTML Code:<ul>This distribution of the J2SE Development Kit (JDK) includes NetBeans IDE, which is a powerful integrated development environment for developing applications on the Java platform. More info...
Download JDK 5.0 Update 6 with NetBeans 5.0 Bundle (English Only)
Download JDK 5.0 Update 6 with NetBeans 4.1 Bundle
The Java 2 Enterprise Edition 1.4 SDK adds support for EJBs, JSPs, XML, and Web Services APIs in a single bundle. More info...
Download J2EE 1.4 SDK</ul>
Thanks for you response and time.
The default location for the installation of the jdk is c:\program files\java\jdk1.5.0_05 (or _06) ... the javac.exe should be in the bin folder.
If your machine does not have a subdirectory like this, the installation program did not complete the installation of the jdk. Re-run the installation program.