This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Yet another Package/classpath problem

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All. I posted this elsewhere, but it was at the end of a topic with a solved problem, so I'm afraid nobody will see it...
I'm using JDK1.3 on win2k, and suddenly my classpath is not working. For the last 8 months, under win2k my classpath has been:
C:\java\jdk1.3\bin;C:\java;
(and before that, JDK1.2.2, and JDK 1.2)and it worked just fine. My projects compiled and ran from the command line.
My classes are in packages:
C:java\org\temiqui\mypackages and they all begin with:
Package org.temiqui.mypackage;
So, in setting up JDBC, I added to my classpath, although I didn't expect I'd have to, since it's in the org folder:
C:\java\org\gjt\mm\mysql;
Which worked for the database project I was working on in Forte, and from the command line. But now none of my other projects will run. They compile fine, but I get a bunch of classLoader exceptions when I try to run them. Forte and Together both agree my package definitions are "illegal" ???
I tried adding the dot:
\java\jdk1.3\bin;C:\java;C:\java\org\gjt\mm\mysql;.
That didn't help either. Is there any way this can get corrupted in the registry or someplace else under win2000? It just plain seems weird. Here's the output....
Thanks,
eric
********************************************************** C:\Java\org\temiqui\calendartable>java CalendarTableApp
Exception in thread "main" java.lang.NoClassDefFoundError: CalendarTableApp (wro
ng name: org/temiqui/calendartable/CalendarTableApp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(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)
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I'm missing something here. If your class is in
Package org.temiqui.mypackage;
and your are running from
C:\Java\org\temiqui\calendartable>
wouldn't C:\Java\org\temiqui\calendartable have to be in your classpath as well. Or of you ran the app from C:\Java there shouldn't be any package confusion.
 
eric moon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what happened, but it got better again %^\
I'm reading every bit of info I can find on the subject of classpaths: it's the black hole of java for me.
thanks!
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
U r using MySQL, hence u need to give the correct classpath where the driver is located.
The driver for mysql is inside a jar file inside the mysql package. u need to give the complete path along with the jar file name. The jar files are
mysql_comp.jar
mysql_uncomp.jar
eg. If these are present in c:\abc\def
then u need to add the full class path for both these jar files
set classpath as below
set classpath=.;c:\abc\def\mysql_comp.jar;c:\abc\def\mysql_uncomp.jar
hope u got it.Ur code will work. If u still have probs, shoot back
Ashu.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic