• 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
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

classpath questions

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One thing that I am not clear about in the Headfirst EJB book - what should I set my default classpath to? Do I need to set it to grab all of the jar files in my Sun/Appserver/lib dir? Also, I set it like a standard environment variable right?

I ask this basic question because the book has me do javac -classpath {$CLASSPATH}:MyPackage.jar when I'm compiling the client source code. So, if someone could clarify this for me I'd appreciate it. note: I was able to get my thing to compile by doing the following:

javac -classpath c:\sun\appserver\lib\ejb-3_0-api.jar;AdviceAppClient.jar

However, even with this I'm now unable to get it to run using the HF (and various modifications based on what worked for the compile) command of
java -cp {$CLASSPATH}:AdviceAppClient.jar AdviceClient

with all of them I get:
Exception in thread "main" java.lang.NoClassDefFoundError: AdviceClient

My dir looks like this:
Directory of C:\My_Programs\EJBClass\Advice

01/25/2007 12:17 PM <DIR> .
01/25/2007 12:17 PM <DIR> ..
01/18/2007 11:00 PM 4,018 AdviceApp.ear
01/18/2007 04:44 PM 4,018 AdviceAppClient.jar
01/25/2007 12:34 PM 1,008 AdviceClient.class
01/18/2007 10:45 PM 1,152 AdviceClient.java
01/04/2007 07:34 AM <DIR> classes
01/02/2007 02:36 PM <DIR> src

I also followed the instructions for the deployment and have the server running. So what did I miss?
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kari Gunter,

Here by {$CLASSPATH} HF is referring to classpath environment variable and along with that if you want to add additional jar then you can. e.g.,

java -cp {$CLASSPATH}:AdviceAppClient.jar

here along with classpath jar's you are adding AdviceAppClient.jar which needs for proper compilation of your java source and you are seperating it with colon( sign(: is seperator on linux platform)...

Well, do add AdviceAppClient.jar in the lib directory of you module and it will start running...

I hope this is what making you slight confusing....

Do let me know if i can assist you more

Cheers !!!
Sumit Malik
 
reply
    Bookmark Topic Watch Topic
  • New Topic