Last active
September 4, 2015 19:51
-
-
Save andreyserdjuk/7b82847d2c01757c185d to your computer and use it in GitHub Desktop.
read file content from jar
This file contains 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
import org.apache.commons.io.IOUtils; | |
try { | |
// approach 1 | |
String extractProducts = IOUtils.toString(getClass().getResourceAsStream("/extractProducts.js")); | |
// approach 2 | |
byte[] bytes = Files.readAllBytes(Paths.get(getClass().getResource("/extractProducts.js").getPath())); | |
String js_extractProducts = new String(bytes); | |
} catch (IOException e) { | |
logger.error("cannot find extractProducts.js, exiting..."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment