Java classpath and directories
来源:互联网 发布:淘宝网天猫丝巾 编辑:程序博客网 时间:2024/05/16 08:22
The java classpath and directories has always been quite a sad story. Of course you were always able to pass a directory of classes to the jvm like this:
java -classpath classes Main
But what you usually deal with these days are jars. Often quite a bunch of them. So fair enough – let’s add a directory with jars as well:
java -classpath classes:lib Main
Up until java 5 all you got was a ClassNotFoundException because java did not search for jars but classes in there. It just ignored the jars. So what pretty much everyone ended up doing is providing yet another shell script to build up the classpath and pass it to the jvm via command line. Of course for bigger projects this let to…
java -classpath lib/commons-logging-1.1.1.jar:lib/commons-jci-core-1.0.jar:commons-io-1.2.jar:lib/junit-3.8.2.jar:lib/maven-project-2.0.8.jar:lib/rhino-js-1.6.5.jar: ...
I guess you see where I am going …an unmanageable mess of a command line. But thankfully times have changed. Starting with java 6 (mustang) you can now use wildcards in the classpath:
java -classpath classes:lib/'*' Main
Naturally this means that the order of the jars is implicit. Which in turn means you need to be extra careful when there are classpath clashes. But in general I think this is a nice feature that should have been there from day one …and I just found out about it.
- Java classpath and directories
- List files and directories
- Files and Directories
- 4-Files and Directories
- Files and Directories
- setting path and classpath after java installed.
- About Folders, Directories, and Pathnames
- cp - copy files and directories
- 170621 Linux and Windows directories
- APUE-Chapter4. Files and Directories
- linux 学习笔记之 Files and Directories
- LDAP Directories Explained: An Introduction and Analysis
- Ignore Files and Directories in Subversion
- Apache Tomcat 6.0 Directories and Files
- Clean Empty Directories on Unity3D and Git
- File and Directories 《APUE》Chapter-4
- How to Set Classpath for Java on Windows and Linux
- java classpath
- c++类型转换
- 分糖果(最短路)
- webkit WinCE port 开发环境搭建过程
- linux/ALSA SRC重采样造成的问题及解决
- 使用Activity做弹窗
- Java classpath and directories
- Linux下的I/O复用与epoll详解
- Java开发中的23种设计模式详解(转)
- 获取签名并转化
- GDOI'2016模拟day1 —— 大水题(就是这个名字)(circle)
- Code Forces Bear and Forgotten Tree 3 639B
- 操作系统vm workstation的u盘的挂载
- kconfig 和 config.in 语法 翻译
- ZOJ 3922Candy with chocolate(几何)