问题
I am wondering if there a way to add Referenced library in blueJ. In eclipse, you can add the referenced library by clicking Build Path>> add external jar
. How can you do it in blueJ? It is because I would like to use other library such as javax.mail, hibernate, and also log4j in BlueJ.
回答1:
I didn't find your question clear, but if you are asking about adding a library into Java we should use the keyword import. For example if i want to import the libraries and classes of all objects I use:
import java.io.*;
Hope you got your answer.
回答2:
Go to Tools -> Preferences -> Libraries -> Add file Press OK and restart BlueJ you can now see that library is loaded.
"One of my favourite IDEs out there is BlueJ"
— James Gosling, creator of Java.
https://www.bluej.org/
回答3:
If you're looking for using those libraries in just one class - then you can move the .jar files into the same directory as the project file and then simply import them using:
import simpleIO.*;
However, if you are looking to import these libraries in multiple projects, it's better to reference the library locations rather than making copies in each BlueJ project.
Open "Preferences">"Libraries" - Then add the location where your classes are as a library path. Restart BlueJ - Now the selected libraries will now be available in all projects that you open.
http://www.bluej.org/faq.html#faq_How_do_I_use_custom_class_libraries__JARs__
来源:https://stackoverflow.com/questions/32346079/adding-library-in-bluej