javadependenciesinstallationjmagick

Is there a better way to setup/run this Java program?


My file structure looks liked this:

cse408 - lib  
       - pics  
       - App.java  
       - ImageUtil.java  
       - Menu.java  

And to compile/run I use the following commands:

***To Compile***
LD_LIBRARY_PATH=/home/soldiermoth/Downloads/6.4.0/lib javac -classpath lib/jmagick.jar:. App.java
****************

****To Run******
LD_LIBRARY_PATH=/home/soldiermoth/Downloads/6.4.0/lib java -classpath lib/jmagick.jar:. App
****************

As you may be able to tell I have a dependency on an installed jmagick library where the jmagick.so file is in 6.4.0/lib

Mostly I'm wondering about how I'm handling dependencies and how I could do it better especially cross platform.


Solution

  • It's more common to have source files under a source directory, and then in the package structure beneath that.

    so I'd expect to see

    cse408 - lib  
           - pics  
           - src
               App.java  
               ImageUtil.java  
               Menu.java 
    

    At the very least. If your code is in the com.soldier.moth package, I'd expect

    cse408 - lib  
           - pics  
           - src
               - com
                   - soldier
                        - moth        
                            App.java  
                            ImageUtil.java  
                            Menu.java