Results 1 to 18 of 18

Thread: [RESOLVED] Program compiled but does not run

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Resolved [RESOLVED] Program compiled but does not run

    CIAO
    My programs are compiled but do not run for example if I write the program

    class Abbas
    {
    public static void main(String args[])
    {
    System.out.println("Abbas Haider");
    }
    }

    it is compiled using javac, it even catches the errors if I make some mistake in the syntax, but when it is compiled without errors it does not run. It gives me this message:

    Exception in thread "main" java.lang.NoClassDefFoundError: Abbas

    Plz solve this and thanks in advance
    A. Haider

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Program compiled but does not run

    Hi,

    Have you set the path for the jdk compiler? When I started using java I got that error message..When I set the path, all my programs work fine..

    If your operating system is windows xp/windows 2000 , go to control panel -> system ->advanced -> environment variables ->system variables

    Look for the Path variable. Append this statement to your path value
    Code:
    c:\jdk1.5\bin
    where jdk1.5 is the directory of my jdk compiler. If you have set the path, you may restart your computer to effect the changes..

    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: Program compiled but does not run

    Definitely a problem with environment variables.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Re: Program compiled but does not run

    Problem still persist

    I would like to mention one thing I am using jdk1.3
    Also Applet files do not run but are compiled


    Thanks

  5. #5
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Program compiled but does not run

    Hi,

    I guess theres something wrong with the compiler..Try downloading jdk1.5 or jdk1.4 from Sun Microsystems..Use them instead of jdk1.3...

    Most of the java folks are not using jdk1.3..Another option is to try reinstalling the jdk1.3 compiler in your machine...Then repeat my instructions in post number 2...


    Greg
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  6. #6
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: Program compiled but does not run

    If the problem still persits then you still haven't set your enviroment variables correctly.

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Re: Program compiled but does not run

    As for the environmental variables I cannot figure out whats wrong. Should I have to install my OS again. I worked with the instructions u folks gave for environmental variables but it didnt worked out. I am thinking to reinstall my OS.
    I m using win xp

  8. #8
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Program compiled but does not run

    Quote Originally Posted by Abbas Haider
    As for the environmental variables I cannot figure out whats wrong. Should I have to install my OS again. I worked with the instructions u folks gave for environmental variables but it didnt worked out. I am thinking to reinstall my OS.
    I m using win xp
    This won't solve anything
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  9. #9
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: Program compiled but does not run

    Quote Originally Posted by Abbas Haider
    As for the environmental variables I cannot figure out whats wrong. Should I have to install my OS again. I worked with the instructions u folks gave for environmental variables but it didnt worked out. I am thinking to reinstall my OS.
    I m using win xp
    What's your classpath look like? As CompJy said, reinstalling won't do anything...It will simply reset your variables and you'll have to set them again.

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Program compiled but does not run

    How are you running the program? Do you have a CLASSPATH environment variable set? If so, what is its value?
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  11. #11
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Program compiled but does not run

    15 days just to get java to work!???
    I wonder how long will it take to run Oracle
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Re: Program compiled but does not run

    Hahaha

    ORACLE was not a problem even the java is not a problem at least I know I am compiling my programs correctly only I am unable to see the output I have worked on JAVA as well as ORACLE three yrs ago on other systems
    its only my Machine that stinks

  13. #13
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Program compiled but does not run

    I suggest you try an IDE to get your files running.
    try NetBeans or Eclipse. Those are the good ones I know
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Re: Program compiled but does not run

    thanks

  15. #15
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Program compiled but does not run

    Try those steps, it may solve your problem

    1- Goto the "java control panel" in control panel
    2- goto the "Java" tab"
    3- click on "view" under "Java Application Runtime Settings"
    4- make sure both user and system have values set and a vaild path.

    if any of them doesn't, then Add one or find it
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  16. #16
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: Program compiled but does not run

    run java as exe files.
    This download is a very wonderful tool for all people who can compile java but can't get it to run properly
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Re: Program compiled but does not run

    You wont believe it, but MS J#.net is a cheat version of Java. My files of Java code are running fine in VS J#.net !!!!
    Try it out
    Thats solve my problem for now, I have not switched to Java Applets and JSP etc I wonder how can I tackle with them.........Maybe same trick
    Last edited by Abbas Haider; Mar 8th, 2007 at 12:35 PM.

  18. #18
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: [RESOLVED] Program compiled but does not run

    J# is an entirely different language than Java, even if it is aimed at compatibility. You definitely won't be able to run anything J#-compiled as an applet or JSP.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width