[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipse-dev] Eclipse conflicting libraries issues- Need help
|
Am 05.01.22 um 14:56 schrieb Bubunia Patra:
Hi all,
I am using Eclipse-Workspace and in the same eclipse path (e.g
C:\eclipse-workspace) I have created 2 different JAVA projects.
One java project is using a specific version jars(e.g 3.x) and other
Java project is using (e.g 4.x) version of jars.
I am getting conflicting libraries errors as below. After checking
with experts from the community I got to know that issue was due to
conflicting Libraries only. Any idea how I can use different set of
libraries for different Java projects? Issue is similar to this But i
quite did not understand the response. can anyone please help?
Eclipse only uses the JARs which you mention in the Java Build Path to
build the project for this project. Each project gets their own build
path. Unless you instruct Eclipse to add another project to your build
path, they don't affect each other.
If the project builds, that means the code that Eclipse compiles (i.e.
all the source code you wrote) is compatible with the interfaces of the
libraries on the classpath.
It doesn't mean the program will run. That is because your code calls
some method in JAR X which in turn calls code from JAR Y. Eclipse will
not check that X and Y work together. You will need integration tests
for that.
The error you got means: X and Y are not compatible.
A simple way to check this is to open the Java Type
"edu.stanford.nlp.process.AmericanizeFunction" in Eclipse
(Ctrl+Shift+T). Then right click and "Show in -> Project Navigator".
This will open the .class file in the JAR. That is the most simple way
to see which JAR file contains this class.
You should also check whether The "Open Java Type" dialog finds more
than one entry; that means you have several JARs on the classpath with
the same classes in it. This is usually a source of weird bugs.
Do the same for "edu.stanford.nlp.util.Function". Check the versions of
the JARs to make sure they are the same.
Next, when you run the code from the command line, you should use the
same classpath as Eclipse. Instead of this, you use "*" which can mean
anything. The command line "java" executable has no knowledge of Eclipse
or your project settings and the build path. If you change something in
Eclipse, that will have no effect on the command line.
Try to create a "Launch Configuration" to start the main class and use
that. This way, you can manage the classpath inside of Eclipse and you
can see what you get (and you can debug, too).
Regards,
--
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
http://blog.pdark.de/