[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Java best practices



Hi list,

I was reading the policy, but I have some questions to do.

I'm developing an application using eclipse, just fine, so tried to
compile my application by hand on one terminal. That was hard, I'm a
wannabe java programer. I had to do this, on the root directory of my
package:

$ ls -la
total 280
drwxr-xr-x   3 user user   4096 2006-05-02 16:45 .
drwxr-xr-x  11 user user   4096 2006-05-02 17:06 ..
-rw-r--r--   1 user user 264729 2005-11-30 17:21 dnsjava-2.0.1.jar
-rw-r--r--   1 user user    630 2006-03-29 12:49 log4j.properties
drwxr-xr-x   3 user user   4096 2006-05-02 16:19 org

So inside the org directory here it goes:

$ ls -la org/jpolicy/
total 36
drwxr-xr-x  5 user user 4096 2006-05-02 17:06 .
drwxr-xr-x  3 user user 4096 2006-05-02 16:19 ..
drwxr-xr-x  2 user user 4096 2006-05-02 16:34 actions
-rw-r--r--  1 user user  738 2006-05-02 17:06 JPolicy.java
drwxr-xr-x  2 user user 4096 2006-05-02 16:57 protocol
drwxr-xr-x  2 user user 4096 2006-05-02 16:55 rules
-rw-r--r--  1 user user 2526 2006-03-29 12:49 Server.java

And inside directory actions, protocol and rules there are more
classes. So, to build this I had to first build the class that has
less dependencies, and doing:

javac org/jpolicy/actions/Action.java
javac org/jpolicy/rules/Rule.java

OK,  just use the the standard.
Now things get really nice!

javac org/jpolicy/rules/SPF.java -cp  \
classes:./:/home/user/jpolicy/dnsjava-2.0.1.jar:/usr/share/java/log4j-1.2.jar

So to buid SPF class, I pointed the 'classes', ./ to find the packages
org/jpolicy/actions/ and org/jpolicy/rules/, more the dnsjava class
and the log4j class

Wow, I was wondering if using a makefile would be better, because I
dont want to need eclipse to build my application. I was looking
arround and found ant, really need to read the documentation. Java
packages in Debian use and or makefiles? or other way to build the
binaries?

Another question is, how should I call my application without touch
classpath? The Policy says that you cant change classpath, but if I
run without pointing to log4j and other libraries, my program wont
run. I was wondering if there are any problem creating a shell script
that to the proper setup and call my application, located in
/usr/share/java.

Best regards,

Miguel



Reply to: