Erdinç Albayrak
Erdinç Albayrak

Reputation: 11

How to have a large file in heroku server

We have a RESTful web service on Heroku and we have a 100mb "vectors.bin" file on src/main folder in our eclipse-workspace. I can access the path of the file like this in my local Tomcat environment:

kNNClassifier classifier = new kNNClassifier(new Word2Vec((PollsInterface.class.getClassLoader().getResource("vectors.bin")).getPath().substring(1)), 8);

This results: "Z:/Dropbox/SYNC/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webdevelopment/WEB-INF/classes/vectors.bin"

But when I deploy on Heroku, at the code line above, it returns 500 internal exception on browser, basically it cannot do it.

I checked with Amazon S3 service to use but how do I use a file in my src main folder, is it impossible?

Upvotes: 1

Views: 332

Answers (1)

codefinger
codefinger

Reputation: 10318

In order to access the file with getClassLoader().getResource("vectors.bin"), it will need to be on the classpath. I suspectsrc/main is not on your class path on Heroku. You can add it by putting the file in the -cp option of your Java command.

Upvotes: 0

Related Questions