How to run a program
Hi all
I have one commandline application written in Java, that depends on other files (.jar) to run. This is in Unix.
When I make "java application", the system complains about the missing libraries. If I do "java -cp lib application", where lib is a directory with several files, it fails saying NoClassFound.
How can I run my program?
> Hi all
> I have one commandline application written in Java,
> that depends on other files (.jar) to run. This is in
> Unix.
> When I make "java application", the system complains
> about the missing libraries. If I do "java -cp lib
> application", where lib is a directory with several
> files, it fails saying NoClassFound.
>
> How can I run my program?
Unless java -cp lib contains class files that won't work. I assume that lib contains jar files and not class files. If this is the case the you need to java -cp lib\jar1.jar:lib\jar2.jar:lib\jar3.jar application
You said Unix, so the slashes should be Unix slashes. I'd start each path with the "./" to make it explicit that the path begins with the current directory.
The point is that the paths have to point to the JAR files that you need. They should be real paths, separated by ":", using Unix slashes.
Don't be so passive: "I tried that, it didn't work" doesn't sound very active.
This is a simple problem. If you can't figure it out, you won't get far with Java.
%
> You said Unix, so the slashes should be Unix slashes.> I'd start each path with the "./" to make it> t explicit that the path begins with the current> directory. > Woops, Thanks duffymo. Got the ':', but wrote the wrong '/'