简体   繁体   中英

Add a .class file to a project in NetBeans

Our professor provided a .class file (Out.class) we should use in our Programm. When I create a new project in NetBeans, in what directory am I supposed to copy that file and/or how do I "import" it to my project so I can use it like Out.methodwhatever(var); ?

I have already searched for that problem, but I just found cases where people have a .jar file, but I have a .class file.

Copy the Out.class into some directory ( not your source folder). Make sure you replicate the package structure of that class, eg if that class is actually com.foobar.Out you need to put it into eg libs/com/foobar

The right click on your project in NetBeans, select the "Libraries" category, and click on the "Add JAR/Folder". The select the eg the libs folder from the above example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM