Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-08-2008, 05:10 PM
Hiro ZA's Avatar
Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 8
Hiro ZA is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-09-2008, 08:27 AM
Hiro ZA's Avatar
Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 8
Hiro ZA is on a distinguished road
somebody? anybody? advice please ?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-09-2008, 08:42 AM
Hiro ZA's Avatar
Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 8
Hiro ZA is on a distinguished road
haha! no worries, I figured it out :-)

i had to set the classpath and ensure the downline folders matched package names
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the execution path of wait() and notify() ? AegisCruiser Threads and Synchronization 1 04-23-2008 07:16 PM
Method execution time javaplus Advanced Java 3 11-26-2007 10:51 AM
Execution methods – Reflection Java Tip Java Tips 0 11-15-2007 04:19 PM
Execution cut Eric Advanced Java 1 06-27-2007 04:52 PM


All times are GMT +3. The time now is 06:43 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org