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?

[362 byte] By [ogami_ittoa] at [2007-10-2 8:40:21]
# 1

> 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

Caffeine0001a at 2007-7-16 22:42:12 > top of Java-index,Java Essentials,New To Java...
# 2
It didn't work. I used : and ; and it didn't work with either.
ogami_ittoa at 2007-7-16 22:42:12 > top of Java-index,Java Essentials,New To Java...
# 3

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.

%

duffymoa at 2007-7-16 22:42:12 > top of Java-index,Java Essentials,New To Java...
# 4
> 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 '/'
Caffeine0001a at 2007-7-16 22:42:12 > top of Java-index,Java Essentials,New To Java...