开发者

Where do I put Java Dependencies to run crawler4j-2.2.jar?

I'm new to Java and aren't sure where to place the Java Dependencies which are required to run crawler4j. Do I put them in the same folder, or do I put them where Java is located on my 开发者_如何学Gomachine, or what? Please help me.


Putting the dependent JARs in the same folder as your application JAR / bytecode files is a reasonable approach. As others mention, you need to ensure that the actual folder containing the JARs is on the classpath when the JVM is launched to run the application. The -cp argument is the recommended way to do this, and it is common practice to create a little shell script / batch file to launch the app with the appropriate JVM parameters.

Putting them into the Java installation is not a good idea for a couple of reasons.

  • It might have unforeseen side-effects on other applications run using that installation. This includes applications run by other users.

  • It will make upgrading your Java installation to the next patch level more difficult.


You need to put them on the CLASSPATH. If you're running your/the application from the command line you can specify your classpath using the -cp argument for java


You put them in your classpath. The classpath can be specified with the -cp argument when you run the java program.

java -cp depend1.jar;depend2.jar;etc... Class2Run

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜