CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Need your help!

  1. #1
    Join Date
    Jan 2003
    Posts
    23

    Need your help!

    Hi

    I have set the path for my jdk. But, i still have to put all my JAVA programs in the subfolder "BIN" for them to compile and execute correctly. If I run a JAVA program which is not stored in the subfolder "BIN", it does not work.

    Can anyone help me?

    Thanks in advance!

  2. #2
    Join Date
    Jan 2002
    Location
    Halifax, NS, Canada
    Posts
    985
    What OS(including version) are you using, where did you set the path, what is the line that you used to set the path?

  3. #3
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    What is the error message you get when 'it does not work'?

    The usual cause of directory related problems trying to run Java applications is an incorrect classpath setting. The classpath must be set to include all the directories that contain classes used by the application, and all jar files used - this includes the current directory.

    Here's to the happiest days of my life,
    Spent in the arms of another man's wife -
    My mother...
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  4. #4
    Join Date
    Jan 2003
    Posts
    23
    I am using Windows XP. I made use of environmental variables PATH and CLASSPATH.

    Both my PATH and CLASSPATH variables contain: c:\jdk1.4;c:\jdk1.4\bin

  5. #5
    Join Date
    Jan 2003
    Posts
    23
    If i got put my java programs in the subfolder BIN, i got this error
    noclassdeffoundexception

  6. #6
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    Previously you said it didn't work unless the class files were in the bin directory, now you say you get NoClassDefFoundException if they're in the bin directory (that is what you said isn't it?)...

    Whatever, a NoClassDefFoundException means you have not included the specified class on the classpath.

    <sigh> I can only repeat what I said before:
    The classpath must be set to include all the directories that contain classes used by the application, and all jar files used - this includes the current directory.
    In case it isn't clear, this includes the application's class directory too.

    It is not a good idea to put your Java classes in the JDK bin directory (or any other JDK directory).


    Under a spreading gooseberry bush the village burglar lies,
    The burglar is a hairy man with whiskers round his eyes
    And the muscles of his brawny arms keep off the little flies...
    Last edited by dlorde; January 18th, 2003 at 07:03 AM.
    Please use &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

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

Featured