Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java: installing extensions

Options
  • 08-12-2005 2:02pm
    #1
    Closed Accounts Posts: 95 ✭✭


    Having trouble installing extensions for Java. For instance I found a nice looking StringUtils class at

    http://dev.kanngard.net/Permalinks/ID_20030310231613.html

    When I run StringUtils.java, the compiler balks at the lines
    import net.kanngard.util.CollectionUtils;
    import net.kanngard.util.NumberUtils;
    

    From the links at the above page, I download the "Commons Lang" library and another one called "Commons Collections". Problem is I can't find out exactly what to do with the files. Can't find any install help on the site.
    With other extensions I've put the .jar files into my [java install path]\jre\lib\ext\ path, which works sometimes, but not for the above.
    Any one know how to get this working?

    Using jdk 1.5.0_05 on XP v2002 sp2.


Comments

  • Registered Users Posts: 12 daresie


    Ok so basically you're missing two classes, NumberUtils and CollectionUtils, which are in the same package (net.kanngard.util) as StringUtils. (Look at the imports in the source code).

    I googled this guys blog and found the following links to these classes:

    http://dev.kanngard.net/Permalinks/ID_20030310225155.html

    http://dev.kanngard.net/Permalinks/ID_20030310225909.html

    You need to compile all these classes together as they belong in the same packages.

    I hope you're using the code for good, not evil.;)


  • Closed Accounts Posts: 95 ✭✭rowan


    Ok I got both those two .java files, put them in the same folder as StringUtils, compiled both, then compiled StringUtils again.

    The compiler still has a problem with the same two lines.
    Maybe I need the full package net.kanngard.util?


  • Registered Users Posts: 4,188 ✭✭✭pH


    If you're bringing over the the java files, then they have to be in directories corresponding to their package entries, putting .java files from different packages into the same dir won't work.

    Try and get it working using jar files, use the classpath (-cp) option when compiling to get jars added to the compile environment.

    If you're not sure that the classes are in the jar you can open a .jar with winzip or winrar and see if these are the right jars. In your case they should have a directory structure /net/kanngard/util/CollectionUtils (inside the jar as seen by winzip)

    - sheesh Jul 2001 and neither of us can be bothered posting - spooky!


  • Registered Users Posts: 885 ✭✭✭clearz


    if its just them 2 files you are dealing with open them up and remove the line 'package net.kanngard.util; at the top of them.


  • Closed Accounts Posts: 95 ✭✭rowan


    thanks guys, got it working by clearz solution which seemed the most painless


  • Advertisement
Advertisement