Basic code to switch LED for PIC18f4550 C18 not working
The pins you are using are also analogue inputs, so you need to make sure these are off. Also turning the comparators off is a good idea, in case you want to use RA0 to RA5.

The code is:

CMCON = 0x07;
ADCON1 = 0x0F;

Read the section on the IO Ports and the ADC, it tells you all you need to know.