Le 2013-01-07 11:10, George Xu a écrit :
Hi,
Hi George,
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".
You need to put both the commons math jar *and* the directory which
contains
the Test.class file in the classpath. You can add several elements in
the classpath by
separating them with ':' (for Unix) or ';' (for Windows). So you will
end up with
someting similar to:
-classpath
C:\some\path\to\commons-math3-3.1.jar;C:\another\path\to\directory
BTW, is there introductionary PDF doc for questions like this?
We do not hold this kind of tutorials at the Apache Commons project.
I'll suggest
you to look for introductory tutorial to run any java programs from the
command
line. The problems you encounter are not specific to Apache Commons
Math, they
correspond to general Java usage.
best regards,
Luc
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));
> }
> }
> }
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]