开发者

Where do you add 'commons-codec-1.4.jar' to if you want access to encodeHexString etc?

开发者 https://www.devze.com 2023-02-06 17:07 出处:网络
Hey, this question links into another postI made today: Reading the first 10 bytes of a file in Java Having been told that my solution could involve the apache commons codec library, I\'ve tried to f

Hey, this question links into another post I made today: Reading the first 10 bytes of a file in Java

Having been told that my solution could involve the apache commons codec library, I've tried to figure out where the file needs to be placed 开发者_运维问答and am seriously not getting it. Can't find anything online that simply says 'It goes here...' so maybe someone on here can help?

I've got Windows 7, I'm using JCreator and have the 'jre6' and 'jdk1.6.0_23' folders in my Program Files/Java folder

Any help at all would be appreciated so please let me know :)

Thanks :D


You need to reference the jar file (not the containing directory) via your class path (a list of directories and .jar files)

e.g. from a command line:

$ java -cp {complete path to jar file} YourClass

Alternatively you can set the CLASSPATH environment variable.

See here for more details.


You may also specified globally CLASSPATH environment variable i.e:

unix: export CLASSPATH=/path/to/jar1.jar:/path/to/jar2.jar: ...

windows: set CLASSPATH=c:/path/to/jar1.jar;c:/path/to/jar2.jar

Remember on windows classpath separator is ";" and on unix/linux it is ":".

It is also correct for -cp option mentioned in previous answer by Brian

0

精彩评论

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