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

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.

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.

A built-in HTTP preview server will be part of Intellij IDEA 13 and is already available in the EAP: http://youtrack.jetbrains.com/issue/WEB-7148
"All existing actions — preview in browser (pop-up over html file or menu action or
shortcut), open in browser and create/debug html file action now open file on built-in web
server
http://localhost:63342/<project name>/<file path relative to source or content root>"
In other words, right-click on an HTML page and select "Debug" or "Open in browser", and IDEA 13+ will serve up that page via port 63342.

Here's another super simple option, install Python: http://www.python.org/getit/
Then open a shell prompt, navigate to your root web folder (e.g. public) and run python -m SimpleHTTPServer - This starts an HTTP Service on port 8000.
Further reading should you need it: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
I've got mine running on Windows 7 but the above article still applies.

Another option is is create a PHP project that, starting with v 5.4.0 of PHP includes a built in web server. This page explains it all ...
http://www.jetbrains.com/idea/webhelp/php-built-in-web-server.html

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
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
Now you can run the configuration:
Click run or debug 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.
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.
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: . 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:

One simple way is to create a NodeJS / Express project in IntelliJ that is your web server. You can then use it to serve your static web pages and any other web content. The NodeJS web server is very small and runs fast - noticeably faster than IIS and Apache. Best of all you can just hit the Run button in IntelliJ or WebStorm to start it up.
By default, a NodeJS / Express project includes a public/ directory that you can use to contain your static pages that you can then view from http://localhost:3000/
This explains the steps required to enable NodeJS in IntelliJ and includes links to other Node resources:
http://www.jetbrains.com/idea/webhelp/node-js.html
If you feel the need, you can reconfigure your NodeJS server using server side Javscript code. You can add SSL support or almost any other server side features you care to dream up. Just add NodeJS modules using the npm (Node Package Manager) command line tool included with the install. NPM Registry https://npmjs.org/ indexes all the available modules.

You can configure IntelliJ to use a lot of different application containers, but each of them must be downloaded and installed separately. I currently have mine configured to serve via jetty, like eclipse, and also tomcat, tc-server, jboss, and node.js. It's pretty easy to set up.

Related

intellij : "search results are not loaded check the internet connection"

Using Intelliji for Java, I'm trying to get cucumber plugin, so i go to the file dropdown menu and go to settings menu and go to plugins. I type in cucumber in the plugins search bar. But nothing is found in the search results.
The message given is " search results are not loaded check the internet connection "
I also get " marketplace plugins are not loaded. Check the internet connection and >refresh< "
My internet connection is fine. I've already downloaded a load of dependancies using maven via intellij. the refresh button doesn't help. Why does intellij think the problem is no internet connection? How do I get intellij to find plugins?
I needed to set up a proxy under Appearance & Behavior Settings, System Settings, HTTP Proxy. I selected auto detect proxy settings. After this I was able to see plugins in the marketplace window.
For me I was able to get the marketplace working when I went to
Configure>Settings>HTTP Proxy Settings> Auto-detect proxy settings>Automatic Proxy configuration URL: https://plugins.jetbrains.com
Actually it seems to be working even without the Automatic Proxy configuration URL disabled
The changes of the settings work for me:
As mentioned in one of the comments on this link, I made the following changes:
Enabled Auto-detect proxy settings under Appearance & Behavior > System Settings > HTTP Proxy.
Removed the below flag under the Help > Custom VM Options.
-Djsse.enableSNIExtension=false
Restarted Intellij after making these changes. Made these changes on Intellij Ultimate 2019.3.3
There are a couple of things you can try.
I will start with what worked for me!
I felt my IP was blocking the plugins, I enabled the VPN and it worked!
for some version IntelliJ looks for plugins using HTTP protocol instead of
HTTPS, so add the following lines
IntelliJ bin folder-> idea.properties,
idea.plugins.host=https://plugins.jetbrains.com
try disabling the SNIExtension, Help->Edit Custom VM options
Djsse.enableSNIExtension=false
Such questions we should refer to the log of IDEA at first.
visit the menu Help ~> Show Log in Exporer, will open the directory of log,
For me,the log file is C:\Users\lawev\AppData\Local\JetBrains\IntelliJIdea2020.1\log\idea.log.
open the file we can find such contenet
2020-09-10 12:39:16,795 [ 158219] INFO - ateSettings.impl.UpdateChecker - failed to load plugin descriptions from https://plugins.jetbrains.com/idea: SSL error probably caused by disabled SNI
Now I see ,visit the menu Help ~> Edit Custom VM Options, check or add this line
-Djsse.enableSNIExtension=true
now it's ok!
my envirment is win10 1909,Intellij UI 2020.1
Starting IntelliJ (2019.2.1) on Windows 10 64-bit in Admin mode fixed this for me.
in my case, my goland settings somehow get corrputs, i delete the folder ~/.GoLand2019.2, and restart goland, then the marketplace works.
in my case, it happen because your internet service provider/ISP block https://plugins.jetbrains.com. There is 2 ways i solve it:
Before i use Sm'rtfren SIM Card Phone(from my country) provider which is can not load marketplace plugin. Then i switch to Tr'e SIM Card Phone provider and it works!
You can use UrbanVPN Desktop software, i use windows version. it will change ISP IP and then it works!
I encounter the similar problem in Android Studio when I want to install the Flutter& Dart plugins .
For me,I install Shadowsocks vpn proxy(https://github.com/shadowsocks/shadowsocks) in my computer.Then I change the Shadowsocks vpn proxy to global mode. After this I was able to see plugins in the marketplace window.Hope it can help you

How to preview a static site?

With Ruby on Rails I can run rails s -p 3000 and preview my site at localhost:3000.
With React I can run npm start and view the site at localhost:8080.
What if I just have html and CSS files, how do I preview that?
On OSX, you can run a simple web server from any directory using this command:
python -m SimpleHTTPServer 8000
Then, you can hit the directory in your browser by going to http://localhost:8000/path/to/file.html
You can try click 2 times in index.html to open the file in browser.
Every time you update the code in sublime text, you need to reload the browser and the updates will be aplied.
This usually depends on your device/OS and what your eventual goals are, but usually you can either use (online) software that renders the HTML and the CSS for you (such as Brackets.io, etc.) whilst you are typing it (to live preview any modifications/additions), or you can put the documents live using a local webserver such as Xampp or OSXs built in simple web server, and check their respective localhost locations every time you save changes using your code editor.
You could also simply use online applications like Codepen, which can also render HTML and CSS, and even JavaScript. Codepen just today launched Codepen Projects which allows you to create entire website projects at their website. It is however, a pro (paid) feature.
Here's a short overview of code playgrounds that offer the functionality you requested (by no means an exhaustive list):
JSFiddle
CSSDeck
CodePen
JSBin
And ofcourse you can insert Snippets here on StackOverflow, which is also able to render HTML and CSS (and JS).
If you really only use HTML and CSS, previewing in a browser is also possible, opening the .html file by double clicking and opening in Internet Explorer, Chrome, etc.

How to run Php Pages in Netbeans

I have just successfully deployed Quercus on Glassfish 4.1. I tested in the browser
http://localhost:8080/quercus-4.0.39/ and saw this:
Congratulations! Quercus™ Open Source 4.0.39 is interpreting PHP
pages. Have fun!
Then ran Netbeans Tools > Options > PHP > Activate PHP Support
It worked. I now see this:
So I made 3 tests:
I ran a php page in an html application but instead of displaying the page it prompts a download box to open in Notepad
I created a new PHP project with below configuration:
But when I run the app with above configuration I receive this error:
Firefox can't establish a connection to the server at localhost.
So I tried with a third test with other configuration:
When I run this third test I get a HTTP Status 404 - Not Found error on GlassFish server.
What am I doing wrong? Thank you!
The problems with your tests are:
PHP needs to be interpreted by a web server. Your browser doesn't know what to do with a PHP file, so it just treats it like a file rather than a page to render. Apache is the most common and easiest server to do that with, GlassFish is unnecessary and probably not the best choice for PHP.
In this test, you are trying to visit a web server which doesn't exist. You don't have any server that listens on port 80.
Here, GlassFish is reporting that it can't find the resource you requested. Have you made sure to put your PHP project in the right directory for Quercus (like in step 4 of your documentation link) and made sure you're visiting a valid URL?
I think the best thing for you to do is move away from Quercus. The latest version of it is very old and implements an old version of PHP (version 5, whereas the latest is 5.6). Looking at the official website, the project appears to be dead, with broken links and very old documentation.
I would suggest you investigate installing a WAMP (Windows, Apache, MySQL, PHP) or LAMP (Linux, Apache, MySQL, PHP) stack. There are lots of very easy installers for this approach which will help you get up to speed and a lot of helpful tutorials and documentation.
For those who using tomcat, below are the steps :-
Right click your project --> properties --> Run Configuration --> For Run As, select PHP Built-in Web Server
Go to Tools --> Options --> PHP tab --> in Php 5 interpreter, browse the correct location for php
Then it should works !
In my case , my php is in /usr/bin/php7.0, so I put the path in Php 5 interpreter.

How to disable built-in web server in IntelliJ IDEA for "Open in Browser" command?

IntelliJ IDEA has a built-in web server in the latest releases that works when I use "Open in Browser" command for some HTML file. So, the URL looks like:
http://localhost:63342/file.html
I want to see a file:// based URL (because the web server doesn't links sibling files in the same directory, for example), but I can't find any option to do it. So, how can I disable this web server or maybe where I can find another command to view files in the browser directly? Of course, I can click "Copy Path" and paste it to the url bar of the browser, but I'm looking for a more convenient way.

How to disable WCF Test Client - VS 2012

I have a new WCF Service Application, when I hit F5 to debug, the WCF Test Client always comes up, but I would like to disable it since I am using soapUI to test instead.
I have tried the answer here - https://stackoverflow.com/a/8441887/903056 but this XML node is no longer in the project file for VS 2012. I have tried several other things myself as well, such as changing default start page and trying to force debug to start a browser session instead.
This is realy frustrated but you can try one of the followings to disable the WCF test client:
1.Open the requested project properties and select the Web tab. Select
the Current Page radio button (I believe that the Specific Page
button is selected), Save the project and run(F5).
2.You can modified the prject XML (.csproj) file and add
<EnableWcfTestClientForSVCDefaultValue>False</EnableWcfTestClientForSVCDefaultValue>
attribute to <WebProjectProperties> node. That should be done by the
followings:
2.1 Unload the requested project (right click -> Unload Project).
2.2 Edit <ProjectName>.csproj (right click again on the project)
2.3 Look for WebProjectProperties node and add <EnableWcfTestClientForSVCDefaultValue>False</EnableWcfTestClientForSVCDefaultValue> to it.
2.4 Reload the poject.
I hope you will find that unswer helpfull..
A simple option that works for me (at least in Visual Studio 2012 Update 4):
Open the WCF project properties and go to the Web section. Set the Start Action setting to Don't open a page. Wait for a request from an external application.
After choosing that option I no longer see the WCF Test Client.
I personally usually choose this start action anyway, since I much prefer hitting F5 in my browser than having yet another tab opened each time I hit F5 in VS.
I found a reasonable work around. All I did was add an empty html page to the project, then right clicked on the html file in Solution Explorer and chose Set As Start Page. A debug session starts but it doesn't go to the WCF TestClient. Not elegant but works.
Old thread but found it while I was suffering the same frustration with VS2013. If you run the project (F5) with the (yourProject)\svc.cs file open in the VS editor then the WCF Client starts. If you hit F5 with any other file as the selected and focused file in the VS editor then IIS and the normal first web page starts.
Very simple when one knows.
I had a similar problem, and found this to be caused by the default Start Options under
> Solution Properties
> Debug
>Start Options
>Command line arguemnts:
it was listing a command line argument of /client:"WcfTestClient.exe" which was launching the test client. Simply removing this argument solved my problem.
No need to extra thing just do thing below.
Tools-->Option -->project and solution-->Build and Run and finally
check Only startup project and Dependencies on Run