Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does IntelliJ have an internal web server to serve static content of a web application?

Right now, the directory of my module is defined as an IIS virtual directory and IIS serves the files.

I was wondering whether IntelliJ has an internal web server, which can serve the files, without the need for any third party. Eclipse does.

like image 546
mark Avatar asked Aug 17 '12 00:08

mark


2 Answers

UPDATE: built-in web server is available in the recent IntelliJ IDEA versions (starting from 13). You can find more details in the blog (yes, this feature first appeared in WebStorm).

IntelliJ IDEA has no this feature, you need to install and use any third-party web server that can serve the content from the project folders.

like image 141
CrazyCoder Avatar answered Nov 07 '22 02:11

CrazyCoder


IntelliJ IDEA has a built-in web server that can be used to preview and debug your application. Just watch this YouTube video or follow the steps below.

Option 1

You need to add new 'JavaScript Debug' configuration:

  • Click Add Configuration... or Edit Configurations... in the Navigation bar

    Run | Edit Configurations

  • Click + button in the toolbar or press Alt + Insert to create a new configuration

  • Select JavaScript Debug under the Templates node in the tree view of run configurations
  • Fill in Name, URL, Browser and click [OK] to save the configuration
    Use http://localhost:63342/YOUR-PROJECT-NAME/index.html for URL

    Run/Debug Configurations Dialog

Now you can run the configuration:

  • Click run run icon or debug debug icon button in the Navigation bar (or use Shift + F10 / Shift + F9 hotkeys).

Option 2

Running web page in browser without creating a configuration. Refer to the related IntelliJ IDEA Help article.

  1. In the editor, open the HTML file. This HTML file does not necessarily have to be the one that implements the starting page of the application.

  2. Do one of the following:

    • Choose View | Open in Browser on the main menu or press Alt+F2. Then select the desired browser from the pop-up menu.
    • Hover your mouse pointer over the code to show the browser icons bar: browser icons. Click the icon that indicates the desired browser.

Result

Google Chrome browser with a demo web page served by the Intelij IDEA's built-in webserver:

demo web page

like image 21
naXa Avatar answered Nov 07 '22 02:11

naXa