Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I configure my apache instance to simply load *.java files in browser instead of sending it to me as a download?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Put this somewhere convenient:

AddType text/plain .java

in your httpd.conf file. You can find this file via:

$ /usr/sbin/apachectl -V | egrep "(HTTPD_ROOT|SERVER_CONFIG_FILE)"
-D HTTPD_ROOT="/etc/httpd"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

(the typical location is /etc/httpd/conf/httpd.conf)

then restart your apache with

/usr/sbin/apachectl graceful
share|improve this answer
    
Thanks, is there also a way to set this as the default for all "unknown files"? –  verhogen Jan 29 '11 at 8:05
    

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.