문제

I try to compil with jdom, my directory look like that :

jdom-2.0.5.jar, ParseurXml.java, XMLEnt.xml

i've already try to export my classpath, but It still not woking at all.

My ParseurXML.java contain only tree import, and write that in my stderr :

ParseurXml.java:2: error: package org.jdom does not exist import org.jdom.; ^ ParseurXml.java:3: error: package org.jdom.input does not exist import org.jdom.input.; ^ ParseurXml.java:4: error: package org.jdom.output does not exist import org.jdom.output.*; ^ ParseurXml.java:12: error: package org.jdom does not exist static org.jdom.Document document;

I compile like that: javac -classpath jdom-2.0.5.jar ParseurXml.java

도움이 되었습니까?

해결책

So long as you're in the same directory as these files when calling javac, its' nearly always a good idea to include the current directory in the classpath

On linux you can use this

javac -classpath .:./jdom-2.0.5.jar ParseurXml.java

So the above specifies the current directory at the start of the classpath (i.e. the leading . character)

Then the following : character is a separator

Then the following ./jdom-2.0.5.jar says to look for your jdom jar file in the current directory.

다른 팁

JDOM 2.0.5 is in the package org.jdom2.* and not in the package org.jdom.*.

You must have some code that is using the older JDOM 1.x version.

Have a look at this page where which gives details on how to migrate from one to the other. I don't know why you have code-dependencies of JDOM 1.x classes if you are sure you are using JDOM2, but the migration path should be easy.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top