1 |
Vincent Schut wrote: |
2 |
> Hi all, |
3 |
> |
4 |
> when using java-config-2 from migration-overlay, it says 'deprecated' |
5 |
> for all classpath related functions. I tried to find some more info on |
6 |
> this, but couldn't find it. Maybe someone here can elaborate a bit more |
7 |
> on how to work with java classpath (system and user) in the new gentoo |
8 |
> java system? E.g. if I want to have some packages in my classpath, how |
9 |
> would I do that using the new system? And how is this working |
10 |
> together/conflicting with the current (old) items in /etc/env.d/ ? |
11 |
> |
12 |
> Cheers, |
13 |
> Vincent. |
14 |
> |
15 |
|
16 |
Setting a user and system wide classpath is deprecated because it can |
17 |
cause several issues. |
18 |
|
19 |
For example, say you put the classes from foo-2.0 on your classpath. |
20 |
Then you emerge something that uses foo-1.0. This would because foo |
21 |
would be slotted. However, when the build takes place, foo-2.0 could be |
22 |
on the classpath before foo-1.0. It may have the same classnames and |
23 |
whatnot, but different API. The differences between the APIs could then |
24 |
cause the build to fail. |
25 |
|
26 |
Similarly, this scenario may also occur while running an application. |
27 |
foo-1.0 might be expected, but foo-2.0 is on the classpath first... so |
28 |
it may be missing methods, or have different behavior, and so on. |
29 |
|
30 |
|
31 |
As for what to do instead of setting the classpath, it depends on what |
32 |
you're trying to do. If you have an application that needs a certain |
33 |
thing on the classpath, it is best to have a launcher script which sets |
34 |
the right CLASSPATH. If you're building something that needs a |
35 |
particular library, you should make the something be explicitly aware of |
36 |
what it needs. In ant, this could mean having a lib directory with all |
37 |
the jars (or symlinks to them), then you create a <path> that all your |
38 |
<javac> and <java>'s use. This would really be dependent on how you're |
39 |
building your project. |
40 |
|
41 |
This problem, and workarounds for it, are in the updated user |
42 |
documentation |
43 |
(https://svn.gentooexperimental.org/svn/java/migration/docs/java-user.html). |
44 |
|
45 |
Hope this clarifies, |
46 |
|
47 |
Josh |
48 |
-- |
49 |
gentoo-java@g.o mailing list |