简体   繁体   English

运行本地Java Heroku

[英]Run local Java Heroku

I'm going through the Heroku Getting Started for Java, but I'm having trouble running the example app locally. 我正在阅读《 Heroku Java入门》,但在本地运行示例应用程序时遇到了麻烦。

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 https://devcenter.heroku.com/articles/getting-started-with-java#run-the-app-locally https://devcenter.heroku.com/articles/getting-started-with-java#define-a -proc文件

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." 运行它之后,我得到“在端口5000上启动web.1”,但是当我打开localhost:5000时,它只是显示“此网页不可用”。

Here is the output from CLI 这是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 更新:所以我实际上是自己运行命令的,当我意识到这就是Procfile所做的全部,我得到的最后一行是

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

When this is obviously is a target\\dependency made from mvn clean install? 这显然是由mvn全新安装造成的target \\ dependency吗? 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. 我没有提到的与它有很大关系的是我在GitBash上运行它。 So it was taking everything differently. 因此,一切都与众不同。

Ex. 例如 I had to escape the semicolon for the cp argument. 我必须对cp参数使用分号进行转义。

Short story the Procfile.windows should be 简而言之,Procfile.windows应该是

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. java -cp "target/classes;target/dependency/*" Main也应该起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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