• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class Not Found Question

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Java agent that runs on the web. While running, if it comes upon a line of code that references a class that does not exist, the agent simply hangs. I'll then have to do a http restart on the server. For example, the following line will not execute because the class cannot be found. (I'm still looking into why the class cannot be found.)

variableName = new className();

Isn't there a means of simply checking the availability of the class in the code without causing the agent to hang? I thought that some try-catch logic could do this, but I haven't had success in coming up with this.

Thanks.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Java agent that runs on the web. While running, if it comes upon a line of code that references a class that does not exist, the agent simply hangs. I'll then have to do a http restart on the server. For example, the following line will not execute because the class cannot be found. (I'm still looking into why the class cannot be found.)

variableName = new className();

Isn't there a means of simply checking the availability of the class in the code without causing the agent to hang? I thought that some try-catch logic could do this, but I haven't had success in coming up with this.

Thanks

Yup u can do that

try {
// your class related code here
}
catch ( Class ClassNotFoundException exp ) (
// catch the exception and move on
}

I guess this should solve the problem
 
bhavesh bhanushali
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try {

}

catch ( ClassNotFoundException exp ) {

}

I am sorry the word class was repeated in the earlier code
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic