|
Package/Execution woes [SOLVED]
Hello people
I am certain this is a very simple problem to solve, but alas, my lack of experience renders me helpless.
here is the scene :
I have created a library, with a package, and a class within this package which connects to our oracle DB. the package name is avon and the class within this this package is called ConnectDB.
I then have a program called DBHealth which is stored in a package AvonApps and this DBHealth class makes a call to the avon.ConnectDB class.
the program runs perfectly in NetBeans and it is able to connect to the DB and run a simple health check to pickup invalid DB objects.
but when I try to run it from DOS as a batch executable file, I get the following error :
C:\Java>java -cp c:\Java\Projects\MyApp\build\classes\AvonApps DBHealth
Exception in thread "main" java.lang.NoClassDefFoundError: DBHealth (wrong name:
AvonApps/DBHealth)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknow n Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
So then I tried the following execution :
java -cp c:\Java\Projects\MyApp\build\classes AvonApps.DBHealth
and now I get this error message :
Exception in thread "main" java.lang.NoClassDefFoundError: avon/ConnectDB
at AvonApps.DBHealth.<clinit>(DBHealth.java:17)
so now it seems to have issues with the package pathing of my subclass
how should I be executing the DBHealth class ??
Last edited by Hiro ZA : 01-09-2008 at 08:44 AM.
|