Calling a method from another jar file

Stefan Carlson

I'm still kind of new to java, and one thing I haven't had to work with until now is calling a method from a class that is not in a package that is part of that particular project. I have two jars: ai.jar and functions.jar. Inside functions.jar I have a bunch of classes right inside, so they aren't in folders or anything. Inside ai.jar, I have a class that accesses a particular method inside ai.jar. I've tried to create a reference variable by using functions.jar/get.class and various other things like that, but I always get a classnotfoundexception. How do I do this? Thanks!

Suresh Atta

You have to add them to your Build path of your project.

Then you just need to import that class.

Then create the instance of particular class if it is a instance method.

Other wise ClassnameInJar.method(); if it is a static class.

See examples with screen shots

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Calling a method from another jar file

From Dev

Calling a fullcalendar method/callback from another file

From Dev

Calling a method from another method

From Dev

Calling a method on an instance of a class, from another class (or file)

From Dev

Undefined Method - Calling a class in one file from another

From Dev

Calling a static method inside a class in jar file

From Dev

Calling an impl method from another impl method

From Dev

Exiting from a Method by calling another Method

From Dev

Calling an impl method from another impl method

From Dev

Exiting from a Method by calling another Method

From Dev

Calling one method from another method in Python

From Dev

Calling Test Method from another Test Method

From Dev

Calling a module from another file

From Dev

Calling a method from a helper file

From Dev

Calling a method from a helper file

From Dev

Calling a method of the MainActivity from another class?

From Dev

Calling an AsyncTask from another asynctask in doInBackground method?

From Dev

Calling a method from inside of another class

From Dev

Calling static method from another java class

From Dev

Calling method from one Viewcontroller inside another

From Dev

Calling the paint() method from another class?

From Dev

Laravel: calling controller method from another location

From Dev

calling a method from another form c#

From Dev

Webpy, calling a view from another method

From Dev

Calling a method through from another controller JavaFx

From Dev

Trouble calling method from another class

From Dev

Trouble calling a method from another class

From Dev

Calling paint() from another method in Java

From Dev

Calling instance method from another class ruby

Related Related

HotTag

Archive