[jdom-interest] JDOM-b7 will not compile

philip.nelson at omniresources.com philip.nelson at omniresources.com
Thu Aug 16 07:33:16 PDT 2001


> And still I get "cannot resolve symbol" compile erros 
> indicating the compiler cannot find the classes.  I have no 
> similar problems from the Xerces nor Xalan jar files.
>

Could you send the exact error message and javac call?  Remove all but one
of the entries from your classpath.  That just confuses the issue.   

> It's times like these I think ASP is a viable alternative!  
> These path/classpath issues are BS.

Ha!  You have obviously never had to remove every GUID from the registry for
every method and dll when a COM object was compiled, registered and had to
break compatibility!

Truthfully, the classpath is a very simple concept.  MS's .NET framework
(which I have been spending quite a bit of time with) is moving away from
the registry to a similar mechanism of relative paths and distinct shared
area like jre/lib/ext.  The problem is not classpaths per se but the fact
that classloaders and how they are setup, what they are evaluating, is
normally hidden from the developer.  This type of problem has been around
since computer languages allowed multiple source and object modules and is
common to the dynamically linked objects, perl code, the Windows Registry,
java, and .NET and I think will be around forever.

IDE's generally make it easier to specify class paths.  From the command
line I often run into cases where having a single monolithic system
classpath just doesn't cut it so I use this batch file (or Ant).  I put all
the jars for a specific run into a lib directory relative to my batch file
and then execute that.  Your classes go (with package directories as needed)
in the same directory as the batch file. You can separate the compile and
run version if you like.

@echo off

set LOCALCP=.
for %%i in (lib\*.jar) do (
	call :concat %%i

	)
goto :doit
:concat
	set LOCALCP=%LOCALCP%;%1
	goto :EOF

:doit
set LOCALCP=%LOCALCP%;c:\jdk1.2.2\jre\lib\rt.jar

echo using classpath %LOCALCP%

java -classpath %LOCALCP% yourclassname arguments



More information about the jdom-interest mailing list