-1

I'm trying to replicate the openie4.0 program by: https://github.com/knowitall/openie

The environment is Ubuntu: 18.04, Scala: 2.10.2, Java: 1.7.0_80, sbt: 0.13.18,

I managed to get to the step of "running with sbt:" ''' sbt 'run-main edu.knowitall.openie.OpenIECli' '''

However, I kept facing with the problem of

java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

when I step into to create the stand-alone jar, when using:

sbt clean compile assembly

while trying "sbt -J-Xmx2700M clean compile assembly" (or larger, say 10g, I have 64g on my computer) The above out of memeory problem continues plus:

java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
[error] Not a valid command: J-Xmx10g
[error] Not a valid project ID: J-Xmx10g
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: J-Xmx10g
[error] J-Xmx10g
[error]     

This is super confusing why this command isn't a valid one and I didn't find a solution for this.

Later on I tried to set the universal JAVA_OPTS, not working. Then I take the suggestions from user972946 (last one), which suggest its overriden since the default settings. How to set heap size for sbt?.

Then trying after fixing as he suggested,but still the same.....

env JAVA_OPTS="-Xmx41200m" sbt clean compile assembly

I also took the suggestion from Mike and Cassio from the above link...not working at all.

Really appreciate on any suggestions on this.

Many thanks. HZ

hz2021
  • 41
  • 3

2 Answers2

0

According to Baeldung:

Try exporting this environment variable before running it:

export SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=10G -Xmx10G -Xms10G"

Alternatively, SBT allows us to specify the JVM options on a file named .jvmopts. create a file called .jvmopts in the root of your project and put this inside:

-Xms1g
-Xmx4g
SDReyes
  • 9,798
  • 16
  • 53
  • 92
0

If you take a look at the following line:

[error] Not a valid command: J-Xmx10g

Your sbt cannot resolve this as a valid option, this can be issued since you're using java 7 (make sure java7 accepts -Xmx$size as a valid argument), the same thing goes for sbt 0.13 (which is pretty old). there also must be a file or something related to deployments (a guide or a CI/CD file or something) that you can take help from on how to run the project. (if you use java 8 everything should be fine probably)

AminMal
  • 3,070
  • 2
  • 6
  • 15
  • Aminmal, thanks for your answer. I finnally find it's because the local setting of sbt is cofigured at the installing process...so I go back to that file and changed the configuration. – hz2021 Apr 03 '22 at 15:01