tag:blogger.com,1999:blog-36773632.post4019922988096728249..comments2023-12-19T08:40:05.062-05:00Comments on Java Evangelist John Yeary: Putting the Current Directory in the CLASSPATHJohn Yearyhttp://www.blogger.com/profile/00461192445071361043noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-36773632.post-59851301435026915492011-01-30T13:51:48.067-05:002011-01-30T13:51:48.067-05:00This is true. Even in our case where we use it for...This is true. Even in our case where we use it for patches, I avoid using the wildcard, and "." in it.John Yearyhttps://www.blogger.com/profile/00461192445071361043noreply@blogger.comtag:blogger.com,1999:blog-36773632.post-57260150039665269782011-01-30T09:01:15.964-05:002011-01-30T09:01:15.964-05:00Hi,
Its worth noting that if you have two classes...Hi,<br /><br />Its worth noting that if you have two classes with same name in classpath in that case one which comes earlier in classpath will get picked up. this concept is very useful to test patch releases where you update only few classes to quickly test patch release or have added some debug print statement to troubleshoot any issue. to read more about <a href="http://javarevisited.blogspot.com/2011/01/how-classpath-work-in-java.html" title="How classpath works in Java" rel="nofollow"> How classpath works in Java </a><br /><br />Thanks<br />Javin <br /><a href="http://javarevisited.blogspot.com/2010/12/fix-protocol-interview-questions.html" rel="nofollow">FIX Protocol Interview Questions</a>javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-36773632.post-5839553627072859952008-07-28T19:24:00.000-05:002008-07-28T19:24:00.000-05:00The . (period) indicates the current directory. Fo...The . (period) indicates the current directory. For example, if I created a class called Hello.java and did not assign it a package, when I compiled it I could run it by simply issuing the command <B><I>java Hello</I></B>.<BR/><BR/>I created a directory called <B><I>test</I></B>. I assigned hello to the test package and moved it to the <B><I>test</I></B> directory. I compiled the class and created a jar file. I placed the file in a directory called <B><I>t1</I></B>.<BR/><BR/>I then ran it with the command:<BR/><B><I>java -cp ./t1/* test.Hello</I></B><BR/>Hello World!<BR/><BR/>This resulted in what you expected by recursively looking into the directory to find the jar files and load them.John Yearyhttps://www.blogger.com/profile/00461192445071361043noreply@blogger.comtag:blogger.com,1999:blog-36773632.post-85343779635591795322008-07-23T14:00:00.000-05:002008-07-23T14:00:00.000-05:00You know, I searched everywhere, I can't find how ...You know, I searched everywhere, I can't find how to specify the current classpath and all subsequent directories and jar/zips underneath it on the classpath. Everywhere I look, I see people saying that "." is the current directory, but not in a working example. I think your post is the only one that comes closest to it. So it should be -cp . right? If -cp does not search recursively in ., then what if i want to search under a folder which is under .? would that be: -cp .;./lib/*?Anonymoushttps://www.blogger.com/profile/18098303098350908418noreply@blogger.com