-1

I have a jar utility do do some functionality. i am adding that jar as dependency to a maven application. it uses simple java. i wanted a class inside the jar to be run on application startup. how can we do that?

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 25 '22 at 15:53
  • I have a jar file inside which some functionalities are added. And this jar is added to a maven project as dependency. I need those functionalities inside the jar file to be run when the application starts without making any reference to any of the classes inside the jar file. I tried using Java timertask but how can we trigger the timer when tha application starts with making any reference to any of the classes inside the jar file.it doesn't uses any java frameworks such as spring. – qwerty123 Feb 26 '22 at 18:46

1 Answers1

0

Create a new Object. com.example.Foo inside JAR lib.

com.example.Foo foo = new com.example.Foo();
Vy Do
  • 46,709
  • 59
  • 215
  • 313
  • didn't get that. you mean i have to just create an instance of the class ? where should i create that, i mean in which class – qwerty123 Feb 24 '22 at 15:51