What is a .class file and how do you make them?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 15 of 15

Thread: What is a .class file and how do you make them?

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    UK
    Posts
    4

    Exclamation What is a .class file and how do you make them?

    Exactly what the title said.
    What is a .class file and how do you make them?

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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.
    Last edited by nspils; 03-04-2006 at 04:17 PM.

  3. #3
    Join Date
    May 2005
    Posts
    75
    Java creates .class files automatically when it compiles a .java file. The class file is the code needed to run the program.

  4. #4
    Join Date
    Jan 2006
    Location
    Sydney
    Posts
    49

    .class file

    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.
    Arul

  5. #5
    Join Date
    Mar 2006
    Posts
    16

    About class file

    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

  6. #6
    Join Date
    Mar 2006
    Location
    UK
    Posts
    4

    Cool

    Thanks, that helps alot, so where would I find this javac compilier then?

  7. #7
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468

  8. #8
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    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.

  9. #9
    Join Date
    Mar 2006
    Location
    UK
    Posts
    4
    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.

  10. #10
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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.

  11. #11
    Join Date
    Apr 2006
    Posts
    2

    How-To Setup That Minimal Environment?

    Quote Originally Posted by nspils
    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 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?

    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?

  12. #12
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Visit this site, download the "JDK 5.0 update 6"


    http://java.sun.com/j2se/1.5.0/download.jsp

  13. #13
    Join Date
    Mar 2006
    Location
    Multan, Pakistan
    Posts
    4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center