Tuesday, 21 February 2012

Installing .msi files with wine

In a terminal enter;

wine msiexec /i your_file.msi

This will open the file as an exe allowing you to install/run the application.

To reboot wine enter;

wineboot

Linux execution/boot levels

This is the first process that is run by the Linux kernel and is what loads the rest of the system.

There are a number of different execution/boot levels i.e. the mode the computer operates.

The default init is set by a variable called initdefault found in /etc/inittab.

The execution levels are;

0: Halt (i.e. shut down)
1: Single user - reduced set of services, used if others do not boot
2: All services excluding network
3: Full user (no GUI)
4: Not used
5: Full user (with GUI)
6: Reboot

To change the init level enter init [mode] (e.g. init 3). To change the init on startup, change the initdefault value in the inittab file.

To check which level you are on use the who -r command.

For more commands use man init.

Wednesday, 2 November 2011

/bin/sh^M: bad interpreter: No such file or directory

I got the following error when attempting to run a .sh file I had obtained;

bash: ./thefile.sh: /bin/sh^M: bad interpreter: No such file or directory

After a little bit of research it turns out that the file had been written on Windows and then exported thus creating a basic text format issue.

Under DOS (Windows/PC) the end of a line of text is signalled using the ASCII code sequence CarriageReturn,LineFeed (alternately written as CR,LF or the bytes 0×0D,0×0A). On the Macintosh platform, only the CR character is used. Under UNIX, the opposite is true and only the LF character is used.

To fix this I ran the following command which converts the file to UNIX format;

dos2unix thefile.sh

Information on the dos2unix command can be found here.

Monday, 31 October 2011

How to start Jasper server in Linux

To start a JasperSoft server in Linux go to your Jasper server install directory, typically /usr/local/jasperserver/

cd /usr/local/jasperserver/

Then run the start command on the Jasper control shell script;

./jasperctl.sh start

This can be done in one with the command;

./usr/local/jasperserver/jasperctl.sh start

Wednesday, 26 October 2011

Recompiling Virtual Box's kernel

I recently installed some updates on my openSUSE Linux machine and found that my VirtualBox machines were no longer starting. I was receiving an error similar to the image below.


To fix this I needed to recompile my VirtualBox kernel. To do this I opened up a console as root (using su and my root password) and ran the following commands;

cd /etc/init.d/
./vboxdrv setup

Tuesday, 13 September 2011

Edit Glassfish JDK path

I recently downgraded my version of Java to compile code for an old project. When I started my Glassfish domain I recieved an error;

The system cannot find the path specified.

When Glassfish is installed it hard-codes its reference to your JDK location. To fix this problem I ended up having to edit a file named asenv.conf (asenv.bat in Windows). The file is located at: /usr/local/glassfish/config/ (C:\glassfish\config\ in Windows).

I 'vi'd into the file and changed the AS_JAVA attribute to my new JDK location;

vi /usr/local/glassfish/config/asenv.conf
AS_JAVA="/usr/java/jdk1.4/"

In Windows you could use these commands to comment out the old reference and add the new one;

REM set AS_JAVA=C:\Program Files\Java\jdk1.6.0_24\jre/..
set AS_JAVA=C:\Program Files\Java\jdk1.4

Tuesday, 6 September 2011

Setting JAVA_HOME and PATH variables in Linux

JAVA_HOME

JAVA_HOME is the directory where your Java JDK is installed. To set this; In a Linux Terminal use the export command to set the variable.

JAVA_HOME=<path-to-java>

If your path is set to /usr/java/jdk1.6.0_24/bin/java, set it as follows:

export JAVA_HOME=/usr/java/jdk1.6.0_24/bin/java

PATH

Set this variable to run Java commands without referencing the absolute location of Java every time i.e. javac MyClass.java rather than /usr/java/jdk1.6.0_24/bin/javac MyClass.java. To do this, also in a terminal append the <path-to-java> to the PATH variable using the export command.

PATH=$PATH:/usr/java/jdk1.6.0_24/bin

To see the changes use the echo command.

echo $JAVA_HOME
echo $PATH