Saturday, January 16, 2010

Easily Set Up a WebServer with a StandAlone Executable JAR

To set up a WebServer on your machine, a very easy way would be to use 'ABK SiteHoster', a project currently in its beta stage... just a standalone executable JAR... no complex configuration required...

demo @ Youtube: http://www.youtube.com/watch?v=CogPa646vi8

Using:
[Step#1]
Download JAR file from any of the two locations below

Sourceforge Link : http://sourceforge.net/projects/sitehoster/ 



say you downloaded a file named "http09_v0.5beta.jar"

[Step#2]
Copy your WebSite (currently no Server Side Scripting supported) to any folder, whose Absolute Path is say "C:\temp\WebDocs"

[Step#3]
open command prompt, change directory to "http09_v0.5beta.jar"'s directory and execute following command

cmd> java -jar http09_v0.5beta.jar "C:\temp\WebDocs"

if you want "C:\temp\WebDocs\index.html" to be default file opened at Website root, then instead run following command

cmd> java -jar http09_v0.5beta.jar "C:\temp\WebDocs" index.html

if Port 80 of your machine is already busy, and you want to run it at some other port say 1234, then run following command

cmd> java -jar http09_v0.5beta.jar "C:\temp\WebDocs" index.html 1234

[NOTE]
if you are on Linux/Unix not Windows follow the Note at end of this post


PreRequirement:
Instrall Java Virtual Machine on your Computer System.

Syntax :

[] Starting HTTP Server hosting web files in folder with as default file to open when root of IP accessed (it opens at Port 80 by default)
SYNTAX:
"java -jar http09_v0.5a.jar C:\WebDoc\ index.htm"

[] Starting HTTP Server hosting web files in folder with as default file to open when root of IP accessed; and 1234 is Port to be opened at (so access like http://IP:1234/index.htm)
SYNTAX:"java -jar http09_v0.5a.jar C:\WebDoc\ index.htm 1234"


NOTE:
to make it work in Linux, download Source Code, extract it and in /SRC/MACRO/appMACRO.java file
change to   and recompile the app