Created
December 1, 2011 09:05
-
-
Save khotyn/1415187 to your computer and use it in GitHub Desktop.
How to read a file as InputStream from the classpath without using any third party library?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.khotyn.test; | |
import java.io.InputStream; | |
/** | |
* Read a file from the classpath without using any third party library. | |
* | |
* @author khotyn 2011-12-1 下午5:03:21 | |
*/ | |
public class ReadFromClasspath { | |
public static void main(String[] args) { | |
InputStream is = ReadFromClasspath.class.getClassLoader().getResourceAsStream("SomeFile"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment