开发者

Symbolic link to libraries for compiling java code

I have a folder that has the spring libraries. I have a separate folder that contains the java code that cont开发者_如何学JAVAains the code for a simple "HelloSpring" application. In order to compile my HelloSpring application, I need to refer to the Spring libraries present in the separate folder. Is it possible to refer to this external folder during the compilation process such that when I type in javac HelloSpring.java, it properly resolves all the libraries being referred to? Is there a way to setup a symbolic link so that the java compiler can look into that to resolve the dependencies.

Thanks


You need to set the classpath to refer to your library folder. You can either do this on the command line when invoking javac, using the -cp option, or you can define a CLASSPATH environment variable.

A better way to work is to use tools like Ant or Maven to handle the build process for you. It takes some time and effort to configure such tools, but certainly when your projects get larger it eventually saves you a lot of hassle.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜