Answer the question
In order to leave comments, you need to log in
Running a java project locally on heroku?
I'm trying to locally launch a Java project on Heroku locally according to this guide: https://devcenter.heroku.com/articles/deploying-ja...
When executing the code, mvn clean install
I get BUILD SUCCESS
.
But when I write in the console heroku local web
I get
Error: Could not find or load main class $JAVA_OPTS
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>tgbot</artifactId>
<dependencies>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>4.1.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
web: java $JAVA_OPTS -cp target/classes:target/dependency/* TgBot
Answer the question
In order to leave comments, you need to log in
The problem is that the environment variable doesn't expand into a set of arguments. This has two reasons. First, on Windows, environment variables are denoted differently. In addition, Windows uses different path and CLASSPATH separators. Therefore, you need to create an additional file - Procfile.windows with the following content:
Second, the JAVA_OPTS environment variable is not defined. This is solved by either removing it from the command or creating an .env file.
Finally, you need to tell heroku which file to run with:heroku local -f Procfile.windows
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question