Some Misc Notes
← prev | next →     Top-level ToC     /java/apps-and-env/projects.html     (printable version)

Create and manage a small Java app (here we assume that your app depends upon an external lib you’ve got in ~/jars/some-lib.jar):

mkdir my-proj
cd my-proj
touch LICENSE.txt
chmod +x
mkdir classes    # Your compiled .class files will end up here.
mkdir -p src/my_pkg
# Edit source files in src/my_pkg (make one of them ...
touch src/my_pkg/
# ... and have it contain the `public static void main` method).

# Work, work, work.

# Build:
javac -sourcepath src         \
      -d classes              \
      -cp ~/jars/some-lib.jar \

# Trial run:
java -cp classes:/home/you/jars/some-lib.jar my_pkg.Main

# Make your jar:
jar cvf my-proj.jar -C classes my_pkg

Put the following into


java -cp /home/YOU/jars/some-lib.jar:/home/YOU/bin/my-proj.jar \
    my_pkg.Main "$@"

replacing YOU with your username, then install your app:

cp my-proj.jar ~/bin
cp ~/bin