I have an error following the next tutorial from Heroku specifically on this part
[https://devcenter.heroku.com/articles/getting-started-with-java#run-the-app-locally][1]
If I execute that instruction foreman throws the following error:
Error: cannot find java class $JAVA_OPTS
I have already declared a env variable like this:
Name variable : JAVA_OPTS
Variable value: -Xms256m -Xmx512m
The Proc file that foreman is trying to execute has the following:
web: java $JAVA_OPTS -cp target/classes:target/dependency/* Main
Im clueless about what is happening.
Note: I already checked some other questions
Running java with JAVA_OPTS env variable
Foreman terminates immediately
Hope someone knwos what is happening.
EDIT : I answered my own question below
I suspect you are running on Windows. If so, then you'll have to reference the JAVA_OPTS var like
%JAVA_OPTS%
. But Heroku will still need the *nix style ($JAVA_OPTS
), so I recommend creating aProcfile.win
next to yourProcfile
with the following contents:Then run this to start your app locally:
This is what I did in order to solve the issue:
Seems that the documentation at heroku site is not clear about what operating system are you using. But then I found the answer in the link below:
Heroku Deploy your Java app locally
The original Proc file script whas like this:
and I modified it as you can see below:
Just as Heroku documentation states.
This solved the problem and I was able to run my app locally
If you're using 'nix,
export JAVA_OPTS
before running the script that expects it.