Contents
This article describes how to install CKFinder for Java.
Installation Procedure
To install CKFinder, download the CKFinder for Java distribution package (a .war
file) from the official download site. You will need to deploy this file to your Java server and run as an application. For detailed instructions on how to run CKFinder on one of the most popular Java servers refer to an appropriate section below.
Running the Sample Application
A test application is available in the _samples
folder of the distribution package. After the deployment open the _samples/index.html
page in your Web browser to see a few usage scenarios for CKFinder.
Basic Configuration
When your application works correctly in the browser, it is time to review its configuration. Go to the config.xml
file where you can customize your application. See the Configuration section for more information about the CKFinder configuration.
Please note that due to security reasons by default CKFinder is disabled. When you reviewed the settings and are ready to go, open the configuration file and enable the program.
<enabled>true</enabled>
Deployment on a Server
The CKFinder Java connector supports the following servers:
- Tomcat 6-8,
- Jetty 9,
- WildFly (former JBoss AS) 8-9,
- JBoss EAP 6,
- GlassFish 3-4,
- Weblogic 11g-12c.
For detailed instructions on how to deploy CKFinder for Java to one of the supported servers, please refer to an appropriate section below.
Tomcat
Place the CKFinder Java .war
file in the Tomcat webapps
folder. Go to Tomcat bin
folder and run the startup script file for your operating system — startup.bat
for Windows or startup.sh
for Linux. When you are running Tomcat as a service, restart the server.
By default Tomcat has the autoDeploy="true"
option enabled (check the Host
element in the server.xml
file). If this option was not changed, running the application should also be possible after you copy it to the webapps
folder without stopping the server.
By deafult, the application should be available under the following URL in your browser:
http://localhost:8080/CKFinderJava/
Please note that the HTTP 8080
port of the sample URL is the default Tomcat port. If you changed this value while configuring your Tomcat installation, you will need to use a modified port value to run the sample application.
If you want to use international files names with CKFinder please see URI Encoding section which explains how to set UTF-8 in Tomcat.
Go to the Tomcat FAQ and Tomcat 6, or Tomcat 7, or Tomcat 8 documentation for more information about using this server.
Jetty
Place the CKFinder Java .war
file in the Jetty webapps
folder. In the command line go to the root of the Jetty server and start it with a java -jar start.jar
command.
By deafult, the application should be available under the following URL in your browser:
http://localhost:8080/CKFinderJava/
Please note that the HTTP 8080
port of the sample URL is the default Jetty port. If you changed this value while configuring your Jetty installation, you will need to use a modified port value to run the sample application.
By default Jetty unpacks war files to folders like C:\Users\admin\AppData\Local\Temp\jetty-0.0.0.0-8080-CKFinderJava.war-_CKFinderJava-any-\webapp\
. Information about this folder is displayed in the output console, when application is deployed.
If you wish to change this folder, you can either put the unpacked CKFinderJava.war
file in the webapps folder (Jetty will use the unpacked application folder) or go to jetty9\etc\jetty-deploy.xml
and set the below parameter to the folder path of your choice:
<Set name="tempDir"><New class="java.io.File"><Arg>C:\tmp</Arg></New></Set>
Go to the Jetty 9 Quick Start guide for more information about using this server.
WildFly
The server can be started from the command line. Go to the WildFly bin
folder and run the following command:
- Windows:
standalone.bat
ordomain.bat
- Linux:
standalone.sh
ordomain.sh
WildFly Application Server can run in two modes: standalone and domain. First one allows running a single standalone Server, while the latter is used to manage multiple physical (or virtual) machines from a single control point.
NOTE: In this example we are going to work with a standalone server.
The above two commands start server with its default configurations. If one wishes to start the server with one of alternative configurations, one should pass the --server-config
argument with the server configuration file to be used. The example below shows how to run the full profile configuration with high availability:
- Windows:
standalone.bat --server-config=standalone-ha.xml
- Linux:
standalone.sh --server-config=standalone-ha.xml
You can read more about available WildFly configurations here.
After the server was started, log into administration console, click Deployments link, next click the Add button, select Upload a new deployment radio button, click Next and select CKFinderJava.war
file. Once CKFinderJava.war upload is finished, verify its runtime name and check the Enable checkbox. The Application is now ready to use.
Another way of deploying the CKFinderJava application is using WildFly Command Line Interface (CLI). It has to be first launched using the jboss-cli.sh
or jboss-cli.bat
script located in JBOSS_HOME/bin
directory. Once this is done, you can deploy applications as in the example given below:
- In standalone mode:
[standalone@localhost:9999 /] deploy ~/Desktop/CKFinderJava.war
- In domain mode:
[domain@localhost:9999 /] deploy ~/Desktop/ CKFinderJava.war --all-server-groups
NOTE: Either --all-server-groups
or --server-groups
with specified server groups must be used.
To learn more about CLI please see this link.
If your Server is running in the standalone mode, then aside from using the administration console and CLI, WildFly can also work in manual and auto deployment mode (this depends on your settings).
In the Auto-Deploy mode the scanner directly monitors the deployment content, available in JBOSS_HOME/standalone/deployments
directory, automatically deploying new content and redeploying content whose timestamp has changed. It means that you can simply drop CKFinderJava.war into deployments folder and the application will be deployed.
To undeploy CKFinderJava in auto mode simply remove war file from deploy directory.
In the Manual deploy mode the scanner does not directly monitor the deployment content. Instead, the scanner relies on a system of marker files, which the user can add to or remove from deployment directory. These files serve as a sort of command telling the scanner to deploy, undeploy, or redeploy the content. You can learn more about marker files in the "Marker Files" section available under this link.
To deploy CKFinderJava.war
in manual mode, copy this file into the JBOSS_HOME/standalone/deployments
directory and create the CKFinderJava.war.dodeploy
file. CKFinder will be deployed and the CKFinderJava.war.deployed
marker file will be created. To undeploy CKFinderJava simply remove CKFinderJava.war.deployed
file.
Please note that by default WildFly allows auto-deployment of zipped content and prevents auto-deployment of exploded content. This is because exploded content is vulnerable to the scanner trying to auto-deploy partially copied content. However, if you wish to change this behavior, you can go to the JBOSS_HOME/standalone/configuration/standalone.xml
file, look for the 'deployment-scanner tag and change the deployment options as you like:
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" auto-deploy-zipped="true" auto-deploy-exploded="false"/>
By default, the application should be available under the following URL in your browser: http://localhost:8080/CKFinderJava/
Please note that the HTTP 8080
port of the sample URL is the default WildFly port. If you changed this value while configuring your WildFly installation, you will need to use a modified port value to run the sample application.
If you want to use international files names with CKFinder please see URI Encoding section which explains how to set UTF-8 in WildFly.
Go to the WildFly Getting Started and Administration Guide for more information about using this server.
JBoss EAP 6
The server can be started from the command line. Go to the JBoss Enterprise Application Platform (EAP) bin
folder and run the following command:
- Windows:
standalone.bat
ordomain.bat
- Linux:
standalone.sh
ordomain.sh
JBoss EAP can run in two modes: standalone and domain. First one allows running a single standalone Server, while the latter is used to manage multiple physical (or virtual) machines from a single control point.
NOTE: In this example we are going to work with a standalone server.
The above two commands start server with its default configurations. If one wishes to start the server with one of alternative configurations, one should pass the --server-config
argument with the server configuration file to be used. The example below shows how to run the full profile configuration with high availability:
- Windows:
standalone.bat --server-config=standalone-ha.xml
- Linux:
standalone.sh --server-config=standalone-ha.xml
You can read more about available JBoss configurations here.
After the server was started, log into administration console, click Deployments link, next click the Add button and select CKFinderJava.war
file. Once CKFinderJava.war upload is finished, verify its runtime name and check the Enable checkbox. The Application is now ready to use.
Another way of deploying the CKFinderJava application is using JBoss Command Line Interface (CLI). It has to be first launched using the jboss-cli.sh
or jboss-cli.bat
script located in the EAP_HOME/bin
directory. Once this is done, you can deploy applications as in the example given below:
- In standalone mode:
[standalone@localhost:9999 /] deploy ~/Desktop/CKFinderJava.war
- In domain mode:
[domain@localhost:9999 /] deploy ~/Desktop/ CKFinderJava.war --all-server-groups
NOTE: Either --all-server-groups
or --server-groups
with specified server groups must be used.
To learn more about CLI please see this link.
If your Server is running in the standalone mode, then aside from using the administration console and CLI, JBoss can also work in manual and auto deployment mode (this depends on your settings).
In the Auto-Deploy mode the scanner directly monitors the deployment content, available in EAP_HOME/standalone/deployments
directory, automatically deploying new content and redeploying content whose timestamp has changed. It means that you can simply drop CKFinderJava.war into deployments folder and the application will be deployed.
To undeploy CKFinderJava in auto mode simply remove war file from deploy directory.
In the Manual deploy mode the scanner does not directly monitor the deployment content. Instead, the scanner relies on a system of marker files, which the user can add to or remove from deployment directory. These files serve as a sort of command telling the scanner to deploy, undeploy, or redeploy the content. You can learn more about marker files under this link.
To deploy CKFinderJava.war
in manual mode, copy this file into the EAP_HOME/standalone/deployments
directory and create the CKFinderJava.war.dodeploy
file. CKFinder will be deployed and the CKFinderJava.war.deployed
marker file will be created. To undeploy CKFinderJava simply remove CKFinderJava.war.deployed
file.
Please note that by default JBoss EAP allows auto-deployment of zipped content and prevents auto-deployment of exploded content. This is because exploded content is vulnerable to the scanner trying to auto-deploy partially copied content. However, if you wish to change this behaviour, you can go to the EAP_HOME/standalone/configuration/standalone.xml
file, look for the 'deployment-scanner tag and change the deployment options as you like:
<deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" auto-deploy-zipped="true" auto-deploy-exploded="false"/>
By default, the application should be available under the following URL in your browser: http://localhost:8080/CKFinderJava/
Please note that the HTTP 8080
port of the sample URL is the default JBoss EAP port. If you changed this value while configuring your EAP installation, you will need to use a modified port value to run the sample application.
If you want to use international files names with CKFinder please see URI Encoding section which explains how to set UTF-8 in JBOSS EAP.
Go to the JBoss EAP Getting Started and Administration Guide for more information about using this server.
GlassFish
The GlassFish server can be started from the command line. Go to the server bin
folder and run the asadmin
script. Next you need to start the domain which is a pre-requisite to upload the application or use the administrator's console. In this example we are going to use the test domain that is deployed with the servr. Run the start-domain
command to start it.
The application can be uploaded to the server by using the command line or the administrator's console.
When using the command line, run the following:
-
deploy relativePath/CKFinderJava.war
Please note that the path to the CKFinder Java .war
file is relative to the asadmin
script that is located in the bin
folder of GlassFish.
When using the administrator's console, log in and go to the Applications tab. Specify the location of the CKFinder Java .war
file and set the application type to Web Application.
By deafult, the application should be available under the following URL in your browser:
http://localhost:8080/CKFinderJava/
Please note that the HTTP 8080
port of the sample URL is the default GlassFish port. If you changed this value while configuring your GlassFish installation, you will need to use a modified port value to run the sample application.
By default, Glassfish has ISO parameter-encoding set, which may cause problems if your users want to use filenames with non-ISO characters. If CKFinder in your application is to be used worldwide, it is recommended to set UTF-8 for Glassfish. Please refer to the URI Encoding section for more details.
Go to the Oracle GlassFish 3.0 or, GlassFish 3.1 or GlassFish 4.x Server Quick Start Guide for more information about using this server.
Weblogic
The Weblogic Server (WLS) can be started from the command line. Go to the weblogic_main_folder/user_projects/domains/your_domain/bin
folder and run the following script:
- Windows:
startWeblogic.cmd
orstartManagedWebLogic.cmd
- Linux:
startWeblogic.sh
orstartManagedWebLogic.sh
If Weblogic is in production mode then please remember that you need to specify the user name and password in order to run it.
As you probably know, Weblogic Server uses domains which are logically related groups of server resources. A domain can consist of an Administration Server and one or more Managed Servers, or of a single standalone server that acts as an Administration Server and runs deployed applications. In this example we are going to use a single standalone Administration Server.
After starting Weblogic, log into the Administration Console and click Deployments in the Domain Structure upper left menu. If WLS is in production mode, you need to click Lock&Edit first. In main panel click the Install button, specify the path to CKFinderJava.war
, and click the Next button. Select the "Install this deployment as an application" option and press the Next button. In the last panel you can change the name of your deployment, the security model and the source accessibility. Once you are done, click the Finish button and CKFinderJava will be deployed. If WLS works in production mode, you will need to confirm all changes by clicking the Activate Changes button and start the application manually by selecting it and pressing the Start button.
By deafult, the application should be available under the following URL in your browser: http://localhost:7001/CKFinderJava/
The HTTP 7001
port of the sample URL is the default Weblogic Administration Server port. If you changed this value while configuring your Weblogic domain(s), you will need to use a modified port value to run the sample application.
Go to the Weblogic 11g or Weblogic 12c Documentation site for more information about using this server.