harp1814
harp1814

Reputation: 1658

Jhipster: What path should be set for user files

I put some *.xls files to src/main/resources/templates/clientdocs folder. and trying to

private static final String FILEIN_NAME = "templates/clientdocs/file1.xls";
....
FileInputStream file = new FileInputStream(FILEIN_NAME))

Also i tried

  "classpath:templates/clientdocs/file1.xls"   

But in both cases i get that file not found. What is correct path should be?

Upvotes: 1

Views: 712

Answers (1)

Gaël Marziou
Gaël Marziou

Reputation: 16284

You can put your file in your resources, e.g src/main/resources/clientdocs/file1.xls and then use a ClassPathResource.

Resource xlsRes = new ClassPathResource("clientdocs/file1.xls");
InputStream xlsStream = xlsRes.getInputStream();

Upvotes: 3

Related Questions