DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4

Thread: Compiling

  1. #1
    Join Date
    Oct 2004
    Posts
    21

    Compiling

    Ok, Im following a book called Just Java 2, it shows how to compile a file and then run it with the command prompt by doing like:

    javac clock.java
    java clock

    (the source code for the script you get from their website)

    but i don't have a program that will let me save a file as .java so i saved it as .js and when i do the javac clock.js it just lists a whole bunch of commands to use with javac like -verbose etc and then i do java clock and it says "Exception in thread main: java.lang.NoClassDefFoundError: clock or any other class in the file.

    The code is at: www.afu.com/jj6

    Thanks

  2. #2
    Join Date
    Sep 2004
    Posts
    223
    what you need to do is simply copy the code from the clock.java file into a new text document on your computer, then rename the text document to exactly the same name as the class, then .java

    so you would
    - copy the contents
    - create a new text file
    - open the text file and paste the java code from the website
    - save and close the text document
    - rename the text file to Clock.java
    - then run your javac command as you were.. "javac Clock.java"
    - then run the clock class like you were.. "java Clock"

    try that
    A kram a day keeps the doctor......guessing

  3. #3
    Join Date
    Oct 2004
    Posts
    21
    thanks , i got it working, i did try that before but windows wouldnt let me change the type like that only the name so i had to use a command prompt

  4. #4
    Join Date
    Sep 2004
    Posts
    223
    do you have file extentions showing in windows? if not then it wont let you change them simply by re-typing the extention. It will think that you want to call your file
    Clock.java.txt, to fix this go into (or something similar):

    Tools -> Folder Options -> View and deselect the box saying "hide file extentions for known file types"

    then all of your file types wil be shown, then you can change them easily
    A kram a day keeps the doctor......guessing

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links