I find that 'package com.foo' prevents two things from happening:
1) it prevents main from running when java is compiled and run;
Works here... I'm using "java -classpath Test/bin com.foo.HelloWorld"
2) it prevents HelloWorld from being imported by the jython interpreter;
from com.foo import HelloWorld
h = HelloWorld()
Test/bin is the root of the class files directory (so there is a Test/bin/com/foo/HelloWorld.class). Of course, if you run "java" or this Jython program from there, you don't have to use -classpath or sys.path.append().
I am not sure what you think a Java package is; did you add a package declaration without changing the full classnames anywhere else?