class not found


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: class not found

  1. #1
    Join Date
    Nov 2004
    Posts
    3

    Angry class not found

    Hi,
    I have made a very simple program ...It goes like this

    package ch03;
    public class mytest {

    public static void main(String[] args) {
    System.out.println("is the class file getting generated");
    }
    }

    when i compile this "javac mytest.java " it gets compiled properly. But when i try to run it..." java mytest " it says class not found. I have also tried running it as "java ch03.mytest ". Could u pls help me abt this.



    package ch03;
    Awaiting replies,
    Thanks,
    Saru

  2. #2
    Join Date
    Aug 2004
    Location
    On the net
    Posts
    38
    Hi,

    The process follows something like this. Give a try.

    1. Compiling the java file -> javac -d . <filename.java>
    2. Running the program -> java <package>.<classname>

    This must work. The reason is that if you simply try to compile as javac <filename.java> it will not generate any package structure and therefore no class file and so it cant find the class file at the time of running.
    This is my understanding.

    For furthur information type javac -d at the command prompt and u must be displayed a pageful of info regarding compiling.

    Good Luck,
    Narayana :-)

  3. #3
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    Also See the "java compilation problem...pls help" thread at

    http://forums.devx.com/showthread.ph...hreadid=135233
    Hope this helps
    Graham

    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)

    http://www.grahamrobinsonsoftware.com

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