Results 1 to 7 of 7
  1. #1
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    162
    Rep Power
    6

    Default hi the program is compiling but not running why

    hi
    please help me the problem is the program is compling but not runing the pgm ,java,path,output bmbs are the image of the programme,java in my system, path is the path settings and output is the output when running

    thanks for reply
    Attached Files Attached Files

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default

    I'm not about to download a 46 KB zip to try to find out what's wrong with your code. Isolate the problem and post a SSCCE.

    What do you mean by "not running"? Recommended reading: How To Ask Questions The Smart Way

    db

  3. #3
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    That's an easy one: your class Test is nowhere to be found in your classpath list (as the jvm already told you so).

    kind regards,

    Jos

  4. #4
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    162
    Rep Power
    6

    Default

    thanks for the reply
    that i know the error oocured
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloRunnable
    Caused by: java.lang.ClassNotFoundException: HelloRunnable
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: HelloRunnable. Program will exit.

    i'm asking why its like this its compling makes the class files then on RUNNING (Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program) it shows the problem is the jre path setting has some problem

    please help me

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by javastuden View Post
    thanks for the reply
    that i know the error oocured
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloRunnable
    Caused by: java.lang.ClassNotFoundException: HelloRunnable
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: HelloRunnable. Program will exit.

    i'm asking why its like this its compling makes the class files then on RUNNING (Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program) it shows the problem is the jre path setting has some problem

    please help me
    Are you trying to run something else now? Don't do that, stick with your previous example: as I wrote: nowhere can that class be found by the jvm; set the classpath variable:

    Java Code:
    java -cp . Test
    kind regards,

    Jos

  6. #6
    javastuden's Avatar
    javastuden is offline Senior Member
    Join Date
    Nov 2009
    Posts
    162
    Rep Power
    6

    Default

    hi
    in my system there is jdk1.5.0_03,jdk1.6.0,jdk1.6.0_12,jre1.5.0_03,jre1. 6.0,jre1.6.0_04,jre6
    are there in C:\Program Files\Java in path also
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;;C:\Program Files\J
    ava\jdk1.6.0_12\bin;C:\Program Files\MySQL\MySQL Server 5.2\bin;C:\Program Files
    \K-Lite Codec Pack\QuickTime\QTSystem\;D:\apache-ant-1.6.0\bin;D:\axis2-1.5.1\bi
    n;

    what is the problem i also do
    >java -cp C:\Program Files\Java\jdk1.6.0_12\bin; HelloRunnable
    then the same there is the class file is created but its not running

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,762
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by javastuden View Post
    hi
    in my system there is jdk1.5.0_03,jdk1.6.0,jdk1.6.0_12,jre1.5.0_03,jre1. 6.0,jre1.6.0_04,jre6
    are there in C:\Program Files\Java in path also
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;;C:\Program Files\J
    ava\jdk1.6.0_12\bin;C:\Program Files\MySQL\MySQL Server 5.2\bin;C:\Program Files
    \K-Lite Codec Pack\QuickTime\QTSystem\;D:\apache-ant-1.6.0\bin;D:\axis2-1.5.1\bi
    n;

    what is the problem i also do
    >java -cp C:\Program Files\Java\jdk1.6.0_12\bin; HelloRunnable
    then the same there is the class file is created but its not running
    Your Java system is a mess: you don't need all those different versions and it is totally not done to stick your compiled Java code in the directory where your tools are stored. Throw everything away, read the tutorials and start over. btw, your path variable and classpath variable are two different things.

    kind regards,

    Jos

Similar Threads

  1. Compiling/Running in Command Prompt
    By coke_in_a_can in forum New To Java
    Replies: 12
    Last Post: 05-31-2010, 10:05 AM
  2. my code compiling but not running
    By girishkumar in forum New To Java
    Replies: 16
    Last Post: 03-16-2010, 05:45 PM
  3. Replies: 2
    Last Post: 03-20-2009, 11:58 AM
  4. Compiling and running code in runtime
    By tim in forum New To Java
    Replies: 4
    Last Post: 01-27-2008, 07:58 PM
  5. Importing / compiling and running with .jar package
    By splinter64uk in forum New To Java
    Replies: 1
    Last Post: 12-05-2007, 03:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •