menemukan nama jar berdasarkan nama class java

Asbaabuttulis [ sebab menulis ], want to know -> in which jar file or package is this file located

Bismillah

q> Dimana letak class JdbcOdbcDriver berada pada file jar yang mana, googling ketemu ini [1]

q> Langsung coba tes code


import java.net.URL;
import sun.jdbc.odbc.JdbcOdbcDriver;
/**
*
* @author saifi
*/
public class NewClass {

public static void main(String[] args) {

Class namaClass = JdbcOdbcDriver.class;

URL location = namaClass.getResource('/' + namaClass.getName().replace('.', '/') + ".class");
System.out.println("Lokasi " + location.toString());
}

}

q> Jalankan dan hasilnya :

Selection_309

Alhamdulillah

sumber [1] :
http://stackoverflow.com/questions/1983839/determine-which-jar-file-a-class-is-from

Published by

saifiahmada

Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s