• 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

batch ClassNotFound on a library in classpath

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,
i'm a new user with a big problem :/

I have a simple java batch (no maven,no spring,...) that run fine from eclipse.

When i put the exported jar (with Ant) into a server and run it with a shell, i receive the error:
java.lang.RuntimeException: java.lang.ClassNotFoundException:a.class.inside.external.library.Y
this is a strange error because the class don't found is inside the same library that call it!

This are the step...

- the shell call main class from my jar
- main class do anyting
- main class call a class inside an external library: a.class.inside.external.library.X
- the class X call another class inside the same library: a.class.inside.external.library.Y
--->>> java.lang.RuntimeException: java.lang.ClassNotFoundException:a.class.inside.external.library.Y

My environment...
The exported jar have inside only my classes
The other libraries are setted on a shell with the correct path

I really don't understand wich is the problem, and hope that you can help me
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

That sounds like a classpath problem. How are you setting the classpath in our app, and where is the .jar with that class in?
 
G Mas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the simple shell is:
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the last line of the .sh (it looks like a shell script not a batch file), what is the character after $JAVA and before HOME? Similarly in the middle of JCLASS PATH?
What is in the JCLASS PATH variable? Why are you exporting TEMP_CLASSPATH and not using it?
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
…and does your .sh file end with a new line sequence?
 
G Mas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm in error with the last line of my example

this line call my main class and start my batch (project.jar)
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

G Mas wrote:. . . this line call my main class and start my batch (project.jar)

The code tags make a point; the word class appears in turquoise print. That is because it is a keyword. It would appear you are using that as part of the path to Main, which suggests you are using class as part of the package name. You cannot use class as part of a package name, so I am surprised you have managed to get that code to compile.

I presume you have underscores _ in JAVA HOME etc. They are not visible in the code tags, however.
 
G Mas
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm back...
- (in my browser) the underscores _ are visible in code tags
- "my.main.class.Main" is an example, to explain that i call "my main class"

other ideas? :/

 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This could well be one of those where the actual values you use are more important.
 
Let's get him boys! We'll make him read this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic