Forums Register Login

Finding a file in classpath

+Pie Number of slices to send: Send
Hi
I need to know how can we validate an import statement.
For e.g
import com.javaranch.ABC;
I need to find out if com.javaranch.ABC class is present in my classpath.
Any ideas?
Thanks
Nehal.
+Pie Number of slices to send: Send
You could try
Class.forName("com.javaranch.ABC")
or
ClassLoader.getSystemResource("com/javaranch/ABC")
Put the moon back where you found it! We need it for tides and poetry and stuff. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 701 times.
Similar Threads
how to import package
executing java program from java
doPost() & doGet()
how to add mail.jar to classpath?
JSP +Bean/EJB
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:04:59.