Posts Tagged ‘windows’

Alfresco document preview doesn’t work for MS Office files (.doc, .docx, .ppt .pptx etc) although it works for pdf files. I get “This document can’t be previewed.” message.

For reasons which are not obvious for me the installation and starting of alfrescoOpenOffice service doesn’t
always work properly during automated Alfresco install/start script execution. If you have the same problem
here is the solution for windows environment.
1. Start – > run  – > services.msc Check if alfrescoOpenOffice service is listed. If not go to {alfresco install dir}\openoffice\scriptsand execute “openoffice_serviceinstall INSTALL” with administrative privileges.

2. Every time after starting alfresco by {alfresco install dir}\servicerun START execute also{alfresco install dir}\openoffice\scripts\openoffice_servicerun START.

3. If you’re not happy with auto starting openoffice service with Windows change alfrescoOpenOffice execution
type to “Manual”.

4. MS Office documents preview in Alfresco should be working just fine now 🙂

Tomcat uses wrong path although CATALINA_HOME and CATALINA_BASE have correct values.

The cause of the problem may be that your web application uses tomcat6.exe instead of catalina.bat to start up.  From my observations it seems tomcat6.exe as opposed to catalina.bat uses environment variables only for the 1st run to copy CATALINA_HOME and CATALINA_BASE values to Windows Registry. Thereafter these parameters start to live on their own;) I had one instance of Tomcat for my Openbravo developer stack and the other for Alfresco. Tomcat6.exe used old values regardless of completly separate instalation of Alfresco dev stack.
You can edit these and other variables directly via Windows Registry editor, the path is:

HKLM/SOFTWARE/Apache Software Foundation/…..

or more conveniently you can use tomcat6w.exe GUI:

tomcat6w //ES//<serviceName> (eg. tomcat6w //ES//alfrescoTomcat)

calls a neat window where you can edit variables you need to run your web app properly.

there’s also //MS// parameter which will call a simple application monitoring given service:

tomcat6w //MS//<serviceName>

If you want to read more about running Tomcat as Windows service with tomcat6.exe go to an article from Apache Tomcat documentation.

Hope this helps someone:)

How to properly run java console application with a doubleclick (Windows)

You’ve developed a java application which runs fine in your IDE but now you want to show your application to the outer world. Running a java program by setting up windows command window and then typing java -jar myProgram.jar paramA paramB .. may be a bit confusing for an everyday user, so the simplier means to do it are quite desirable.

A simple way to achieve this is to use a batch (.bat) file.

Let’s assume you have a console java application which takes one parameter – a configuration filepath and name. You can create a simple script file which will run this application in console for you after a doubleclick.

You should:

1. Create a text file like this :

@echo off
 set jarpath="JavaApp.jar"
 java -jar %jarpath% %CD%\Config.txt
 PAUSE

%CD% is a pseudo-variable which holds the working directory. It’s useful when you eg. want to load a config file located in the same folder as your .bat file.
PAUSE displays a localized version of “Press any key to continue…” message.

2. Save it as .bat file.
3. The program is ready for double click run!