Boards.ie uses cookies. By continuing to browse this site you are agreeing to our use of cookies. Click here to find out more x
Post Reply  
 
Thread Tools Search this Thread
08-12-2005, 13:02   #1
rowan
Registered User
 
Join Date: Jul 2001
Posts: 91
Java: installing extensions

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

http://dev.kanngard.net/Permalinks/I...310231613.html

When I run StringUtils.java, the compiler balks at the lines

Code:
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.
rowan is offline  
Advertisement
08-12-2005, 16:38   #2
daresie
Registered User
 
Join Date: Sep 2005
Posts: 10
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/I...310225155.html

http://dev.kanngard.net/Permalinks/I...310225909.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.
daresie is offline  
08-12-2005, 16:59   #3
rowan
Registered User
 
Join Date: Jul 2001
Posts: 91
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?
rowan is offline  
08-12-2005, 17:41   #4
pH
Registered User
 
pH's Avatar
 
Join Date: Jul 2001
Location: D22
Posts: 3,679
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!
pH is offline  
09-12-2005, 16:30   #5
clearz
Registered User
 
clearz's Avatar
 
Join Date: Oct 2003
Posts: 823
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.
clearz is offline  
Advertisement
12-12-2005, 11:09   #6
rowan
Registered User
 
Join Date: Jul 2001
Posts: 91
thanks guys, got it working by clearz solution which seemed the most painless
rowan is offline  
Post Reply

Quick Reply
Message:
Remove Text Formatting
Bold
Italic
Underline

Insert Image
Wrap [QUOTE] tags around selected text
 
Decrease Size
Increase Size
Please sign up or log in to join the discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search