Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » JAR File Import Problem(JAR File)
JAR File Import Problem [message #1827759] Fri, 22 May 2020 15:04 Go to next message
Yong Chen is currently offline Yong ChenFriend
Messages: 1
Registered: May 2020
Junior Member
Hi guys, I followed the instruction of this video on how to export and import JAR file. It doesn't seem to work.

Look up "What is Jar file? | How to make a Jar in Eclipse?" by Telusko on Youtube.

So I exported Simple_Program folder, which contains, the code is:

package Cal;

public class CalDemo {

public int add(int i, int j) {
return i + j;


Then, I exported the project folder Simple_Program as Calculator.jar (JAR file). Then I created Simple_Program2, inside project folder, I cretead class

package Cal2;

import Cal.CalDemo;

public class CalDemo2 {

public static void main(String[] args) {

CalDemo c = new CalDemo();

System.out.println(c.add(4, 8));



Then, I imported Calculator.jar via "Add External JAR Files" into Simple_Program's Referenced Library. CalDemo.class appears in the .jar file branch instead of CalDemo.jar. Then, when I click on CalDemo.class, it says Source Not Found. So, when I run, I am getting an error. Error message attached in image below.

Also, I tried to assigned path to CalDemo.class and it's not working either. Now, I cannot re-assign path to that file.
  • Attachment: z.bmp
    (Size: 5.15MB, Downloaded 24 times)
Re: JAR File Import Problem [message #1827765 is a reply to message #1827759] Fri, 22 May 2020 19:35 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1832
Registered: July 2009
Senior Member
... when I click on CalDemo.class, it says Source Not Found

That shouldn't surprise. Normally, jars don't contain sources. You could either explicitly include sources in the jar, or provide a source attachment, but neither is required for running.

Concerning the runtime error I suggest to open the Run configuration and visit the Dependencies tab. Does it show your jar file on the classpath? You may also click "Show Command Line" to see exactly how the application is run.
Previous Topic:Boxing of call arguments
Next Topic:Error at update
Goto Forum:

Current Time: Wed May 19 03:42:41 GMT 2021

Powered by FUDForum. Page generated in 0.01497 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top