how to compile source code of "Data Structures & Algorithm Analysis in Java" writen by Weiss
Another question:How to demo the examples under folder of DataStructures?
a) put a build.xml file in the folder the source code in
b) type 'ant' in command line
c) i just made a one copy of build.xml from another place and put it in same folder of source code.
only one thing about 'property name="srcdir" value="src"' is to be concerned.
d) when compiling source code of the folder named Miscellaneous, first i copied all of the source code into
folder named src,then type ant in command line and appeared 36 errors which of them displays
[javac] K:\game\tutorial\CodeWin\src\Concordance2.java:3: package DataStructures does not exist
[javac] import DataStructures.*;
This indicates the source code of Miscellaneous needs package named DataStructures.
Then i copy folder of DataStructures into folder of src and type ant again,this time show
'Success'
要在命令行中run the examples under folder of DataStructures,note a sentence of 'package DataStructure;' in the source code file, so must tell java.exe find some class (such as LinkedList) under folder of DataStructure. in Command Line,should type "java DataStructures/LinkedList",if entry the DataStructures by command of 'cd DataStructures' and then type 'java LinkedList' you will see the followings:
K:\game\tutorial>cd codewin/DataStructures
K:\game\tutorial\CodeWin\DataStructures>java LinkedList
Exception in thread "main" java.lang.NoClassDefFoundError: LinkedList (wrong nam
e: DataStructures/LinkedList)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Aug.11th,2006