Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
143 views
in Technique[技术] by (71.8m points)

java - How can I link source to a jar package in eclipse?

How can I link source to a jar package in eclipse?

I am trying to add the external library ch.ntb.usb.

I added the jar file to my build path, but when I tried to run the application it returned the following error:

The jar file ch.ntb.usb has no source attachment.

I've used JD-GUI to decompile the jar file and the source code is contained.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I doubt that you get that error when you only run the project unless you have an error in your code and eclipse debugger try to show the line of code that cause the exception, anyway you may need source files of a library for debugging purpose, to link source to a jar package in eclipse you can follow these simple steps :

  • Find the package which you want to add the source under Referenced Libraries in Package Explorer
  • Right Click on the library
  • Select Properties
  • Go under Java Source Attachment
  • Select the directory or archive where your source is located.

example


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...