Hi, I compiled with -CLASSPATH and it passed and generated the .class file. (>dir *.class shows)
But when I ran with >java -CLASSPATH commons-math3-3.1.jar(full directory path) Test, it complains "Error: Could not find or load main class Test". BTW, is there introductionary PDF doc for questions like this? George On Mon, Jan 7, 2013 at 4:45 PM, Mat Jaggard <[email protected]> wrote: > You need to use -classpath when you run java as well as when you run javac. > > Also, you need to include [math] on your subject line when posting about > that module to this list. > > > On 7 January 2013 08:29, George Xu <[email protected]> wrote: > > > Hi, > > > > Anyone can help? I am new and has difficulty in compiling with the .jar > > files. > > > > I downloaded the .zip file, unzipped and put the 4 .jar files at > > c:\Users\herehere. > > I wrote a simple test code at the same directory(the current directory, > as > > above. > > .(current directory) is at Environmental Variable, CLASSPATH. But it does > > not > > compile simply by .>Javac Test.java. > > > > I compiled with > > .>javac -CLASSPATH c:\Users\herehere\xxx.jar Test.java (I explicitly > spell > > out > > xxx and tried all four). The compike passed. But cannot .>java Test, and > it > > complains java.lang.NoClassDefFoundError. > > > > Help please, > > > > > > ________________________________ > > import > > java.util.*; > > import > > org.apache.commons.math3.*; > > public > > class Test { > > public static void main(String[] args) { > > System.out.println( > > "Hello World!"); // Display the string. > > Vector v= > > new Vector(); > > v.add( > > "1");v.add("2");v.add("3");v.add("4");v.add("5"); > > v.insertElementAt(v.remove(v.size()-1),0); > > int i=0; > > while(i<v.size()){ > > System.out.println( > > "E @ i:\t"+v.get(i)); > > i++; > > Acosh a= > > new Acosh(); > > System.out.println( > > "acosh:\t"+a.value(2.5)); > > } > > } > > } > > >
