我是 Java 新手,我正在尝试 host a Java web app using Firebase .
问题
我的问题似乎是我的 index.html
文件在我的 Java 文件结构中不存在。因此,我无法在我的 firebase.json
文件中“指向它”。
问题
- 对于如何托管 Java Web 应用程序,我有什么不明白的地方?
- Java Web 应用在部署时是否有
index.html
文件(Firebase 显然需要该文件)? - 如何才能成功托管我的 Java Web 应用?
Firebase 托管设置说明:
SETUP & INSTALLATION
First Time Installation
You should have Node.js installed (you do not need to run Node, just have it installed)
$npm install -g firebase-tools
or$sudo npm install -g firebase-tools
Updating Previously Installed Firebase Tools
$npm update -g firebase-tools
or$sudo npm update -g firebase-tools
DEPLOY YOUR WEBSITE
$cd
into your website directory and run$firebase init
- Then deploy your website with
$firebase deploy
我的错误消息:
当我按照托管说明并浏览到 https://my-example-firebase.firebaseio.com/
时,我收到以下错误消息。
Page Not Found
This file does not exist and there was no
index.html
found in the current directory or404.html
in the root directory.Why am I seeing this?
You may have deployed the wrong directory for your application. Check your
firebase.json
and make sure the public directory is pointing to a directory that contains anindex.html
file.
我的 firebase.json
{
"firebase": "my-example-firebase",
"public": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
}
如您所见,我的 firebase.json
文件假定我的 root
目录是我的 public
目录。但是,它不包含 index.html
文件。因此,这就是我认为我所缺少的关于 Java Web 应用程序和文件结构的结构。没有 index.html
文件。
我的文件结构
(由 Eclipse 搭建)(部分)如下所示。
root
Deployment descriptor: myproject
JAX-WS Web Services
Java Resources
Javascript Resources
build
src
com.example.myproject
MyprojectUI.java
MyprojectUI
test
libraries
WebContent
ivy.xml
ivysettings.xml
我仔细查看了它,没有 index.html
文件。我想知道是否需要将某些内容编译为 HTML 和 Javascript?然后提供该文件?我迷失了,很困惑。请有人帮忙。
最佳答案
Firebase 托管仅用于托管静态资源,例如 HTML、JavaScript、CSS、图像等。
Firebase 托管无法用于运行您的 Java Web 应用程序。
关于java - 我对托管 Java Web 应用程序有什么不明白的地方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32217764/