开发者

Using custom .jar's in your java project

I'm importing from two jar's twitter4j-2.0.10.jar and mysql-connector-java-5.1.10-bin.jar, I'm running the code on a server but it'开发者_如何学Cs not letting me. I get a..

 Streamer.java:9: package twitter4j does not exist
 import twitter4j.StatusDeletionNotice;
             ^

error when compiling. I know this has something to do with getting java to recognise my custom jar's but I don't know how to get java to "see" them.

Any ideas?


You need to set the classpath for Javac.

One possible example (Windows, with your jar files in a folder called "lib"):

javac -classpath lib/twitter4j-2.0.10.jar;lib/mysql-connector-java-5.1.10-bin.jar MyClass.java

That's a very precise example though, your environment could differ considerably.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜