Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: java.lang.NoClassDefFoundError: javax

  1. #1
    Join Date
    Mar 2003
    Posts
    1,700
    Rep Power
    0

    Default java.lang.NoClassDefFoundError: javax

    I'm using JBuilder 9, and I keep getting this error.

    java.lang.NoClassDefFoundError: javax

    So far I've not been able to successfully compile anything. Do you folks have any idea as to what may be wrong? I also get the following pop-up error:

  2. #2
    Join Date
    May 2003
    Posts
    3,041
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    [quote author=Xenocrates link=board=21;threadid=1847;start=0#msg18166 date=1063903425]
    I'm using JBuilder 9, and I keep getting this error.

    java.lang.NoClassDefFoundError: javax

    So far I've not been able to successfully compile anything. Do you folks have any idea as to what may be wrong? I also get the following pop-up error:
    [/quote]

    From what I can remember, this normally happens if the path to your main java classes connot be found. Have you exported the path?

  3. #3
    Join Date
    Mar 2003
    Posts
    1,700
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    Exported? I'm not sure I follow you.

    Is there somewhere I have to go to configure the path to the libraries? Why would that not be automatic?

  4. #4
    Join Date
    May 2003
    Posts
    3,041
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    [quote author=Xenocrates link=board=21;threadid=1847;start=0#msg18169 date=1063904884]
    Exported? I'm not sure I follow you.

    Is there somewhere I have to go to configure the path to the libraries? Why would that not be automatic?
    [/quote]
    You know Xeno... I think that's one of the reasons I stopped using java... ;D
    So youre getting a NoClassDefFoundError.
    Are using iPlanet?
    Some users have reported a problem with JBuilder9 and iPlanet...one guy's solution is :

    1)Remove references to the JCE.jar files from the iPlanet classpath; They conflict with the JCE.jar already in JDK1.4.

    2)Upgrade to at least iPlanet 60 sp5. It support JDK 1.4.

    3)make sure you don't have more than one file in the admin server root that starts with "start-" (i.e. don't save the original config file from start-jvm to start-jvm-orig. If you've got more than one, iPlanet just sorta decides what it wants to do.


  5. #5
    Join Date
    Mar 2003
    Posts
    1,700
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    No iPlanet. JBuilder 9.0. Rectified the issue.

    Turns out that to get your class running you have to select from the main menu:

    Run | Run "[ClassName]" using "Default Configuration"

    Failing which it fails to find the class with this construct:

    public class className {
    public static void main (String Args[]) {
    .
    .
    //yaada yaadaa yaa
    .
    .
    System.exit(0);
    }
    }


    ...by default - which is stupid. Cuz then, exactly how do I configure this thing to do that by default? (by that I mean, how do I configure it to just use the "Run" button to do the "Run using default config"?

    One would think that Borland would have thought of that. JBuilder 9 is actually more difficult to use than JBuilder 3. How much more backward can these people get?

    By the way, I am soliciting suggestions for my previous question...

  6. #6
    Join Date
    Jul 2002
    Posts
    818
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    It may have something to do with your CLASSPATH variable. The thing with java is that whenever you try to compile or run a class file, you need to tell it where to find it's dependencies.

    These settings are sometimes stored as an environment variable within the operating system, if not you'll have to pass it to the executable when you run/compile the class file :

    javac/java -classpath "C:\j2sdk1.4.0_03\jre\lib\rt.jar;C:\j2sdk1.4. 0_03\lib\dt.jar;C:\j2sdk1.4.0_03\lib\tools.jar;C:\ j2sdk1.4.0_03\jre\lib\ext\dnsns.jar;C:\j2sdk1.4.0_ 03\jre\lib\ext\ldapsec.jar;C:\j2sdk1.4.0_03\jre\li b\ext\localedata.jar;C:\j2sdk1.4.0_03\jre\lib\ext\ sunjce_provider.jar" whatever.class

    My IDE of choice is JCreator Pro which does all of that for me. I need only tell it where my jdk directory is and it builds the classpath string and passes it to the java executable everytime I click on 'run'.

    I'm sure JBuilder has a similar setting, just dig arround the config menu until you run into it.

  7. #7
    Join Date
    Mar 2003
    Posts
    1,700
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    CKnight, I believe you're right.

    Question though, how do you know which of the library files to include in the classpath?

  8. #8
    Join Date
    Jul 2002
    Posts
    818
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    The ones listed in the example above are all the packages that ship with Java, which means you can compile and run any application which uses that standard classes.

    If you look at the names of the packages you can deduce which are needed and which aren't. For example, you probably wont have a lot of use for the ldapsec.jar package unless of course you're designing a ldap application so you could safely leave that out (I'm thinking).

    If you have a third class that you used in your application just include the path to that package as well.

    Note: Under linux I found that I needed to include the directory in which the actual class I'm working on resides as well as it's dependencies. This is probably the case with Windows as well but it was most likely handles automatically by JCreator. Just keep that in mind.

  9. #9
    Join Date
    Mar 2003
    Posts
    1,700
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    Ok, so I discovered that the default config uses the following:


    C:\JBuilder9\jdk1.4\bin\javaw -classpath

    C:\Myfiles\classes
    C:\JBuilder9\jdk1.4\demo\jfc\Java2D\Java2Demo.jar
    C:\JBuilder9\jdk1.4\demo\plugin\jfc\Java2D\Java2De mo.jar
    C:\JBuilder9\jdk1.4\jre\lib\charsets.jar
    C:\JBuilder9\jdk1.4\jre\lib\ext\dnsns.jar
    C:\JBuilder9\jdk1.4\jre\lib\ext\ldapsec.jar
    C:\JBuilder9\jdk1.4\jre\lib\ext\localedata.jar
    C:\JBuilder9\jdk1.4\jre\lib\ext\sunjce_provider.ja r
    C:\JBuilder9\jdk1.4\jre\lib\im\indicim.jar
    C:\JBuilder9\jdk1.4\jre\lib\jaws.jar
    C:\JBuilder9\jdk1.4\jre\lib\jce.jar
    C:\JBuilder9\jdk1.4\jre\lib\jsse.jar
    C:\JBuilder9\jdk1.4\jre\lib\rt.jar
    C:\JBuilder9\jdk1.4\jre\lib\sunrsasign.jar
    C:\JBuilder9\jdk1.4\lib\dt.jar
    C:\JBuilder9\jdk1.4\lib\htmlconverter.jar
    C:\JBuilder9\jdk1.4\lib\tools.jar


    - This works. However, I'm sure there are libraries in here that I don't need. I am not building anything LDAP related, or web related, (aside from a few applets). Now I just have to figure out where in JBuilder I need to set this as the DeFacto standard for all projects.

  10. #10
    Join Date
    Jun 2003
    Posts
    159
    Rep Power
    0

    Default Re:java.lang.NoClassDefFoundError: javax

    What do you get when you type at the command prompt the following:
    java -version

Posting Permissions

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