Altherat
Altherat

Reputation: 701

Serving Compiled Scripts on Webserver

I have a webserver running Apache http webserver and it works fine. I can view/download the files I put in the htdocs folder through a web browser.

What I want to be able to do is write Java code in my IDE (using IntelliJ IDEA) and when I compile my project, I want the updated compiled class files to be automatically available on my webserver for download. Currently I am using a PHP script to retrieve the files from my project directory to download them but I want to change this so that the URL points to the actual file and has a .class extension. I need to do this because I plan to load the classes using a classloader in the future. I do not want to manually copy the files from my project folder to the htdocs folder every time I compile.

I've thought of some ways to do this but they aren't ideal:

  1. I could use some program that syncs files between two folders and have my project folder sync the class files to the htdocs folder. I don't really want to rely on another program and this just seems like the wrong way to do it.

  2. Create a VirtualHost on my webserver and have the project folder as a subdomain. This doesn't seem like that bad of an option but I don't really want to create a sub domain just for the class files.

  3. Change the compiler output path in my IDE to the htdocs folder. This would work but I need to keep the original output path because it is automatically backed up by my Google Drive. It would be good if I could specify an additional compiler output directory in IntelliJ and then have it compile to the default directory as well as the htdocs directory but as far as I can tell this is not possible with IntelliJ.

Are there any other options that I'm missing? What is typically done in this situation if anything? I'm leaning towards trying option #2.

Thanks.

Upvotes: 0

Views: 31

Answers (1)

bob0the0mighty
bob0the0mighty

Reputation: 782

You could try creating a symlink to your compiled code dir in your served Dir.

Upvotes: 1

Related Questions