简体   繁体   中英

Run local Java Heroku

I'm going through the Heroku Getting Started for Java, but I'm having trouble running the example app locally.

https://devcenter.heroku.com/articles/getting-started-with-java#run-the-app-locally https://devcenter.heroku.com/articles/getting-started-with-java#define-a-procfile

After I run it, I get the "starting web.1 on port 5000", but when I open localhost:5000, it just gives me "This webpage is not available."

Here is the output from CLI

$ heroku local web -f Procfile.windows
forego | starting web.1 on port 5000
web.1  | Usage: java [-options] class [args...]
web.1  | in the version search
web.1  |            show splash screen with specified image
web.1  |

Let me know if you need more information.

UPDATE: So I actually ran the command on my own, when I realized, that's all that Procfile does, and the last line I get is

sh.exe": target\dependency\*: No such file or directory

When this is obviously is a target\\dependency made from mvn clean install? What am I typing wrong?

$ java -cp target\classes;"target\dependency\*" Main

This has a lot to do with compatibility.

What I didn't mention, which had a lot to do with it, was that I was running this on GitBash. So it was taking everything differently.

Ex. I had to escape the semicolon for the cp argument.

Short story the Procfile.windows should be

web: java -cp target/classes\;target/dependency/* Main

no quotes anywhere... I'm leaving this up in case anyone else has issues

Using double quotes should have the same effect as using the backslash in this case; ie java -cp "target/classes;target/dependency/*" Main should also work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM