Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More classpath woes

Status
Not open for further replies.

stormbind

Technical User
Mar 6, 2003
1,165
GB
This is the same problem I had before, and only one step closer to the solution :(

d/a/ ... parent directory, where d is desktop
d/a/b/ ... script with main method
d/a/c/ ... all the required libraries

This fails: d > javac a/b/main.java
This appears to compile: d> javac a/b/main.java -cp a/

This fails: d> java a/b/main
This fails: d> java a/b/main -cp a/
This fails: d> java a/b/main -classpath a/

It's very discouraging :(

--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Your information is not complete.

You're talking filenames instead of classes (which have packagenames).

From your listing we don't see, whether it is a d.a.c.Foo.class or a.c.Foo.class in directory d or c.Foo.class in directory d.a or Foo.class in d.a.c.

Packagenames consists of dots instead of slashes:
Code:
cd d
java -classpath a/ a.b.main
From the working compile-command, I guess:
Your libraries are named 'package c' - that's why you need -classpath a/
but your main-class is in packag 'a.b' - a inclusive.

That's confusing.


don't visit my homepage:
 
a/b/c : a.core
a/d/e : b.core
a/link.class (no package)

This works:
a/main.class (no package)

This does not:
a/f/g : main.class (no package)


--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top