How to change the path of a jar file imported to a Netbeans project? - netbeans

i imported a jfeonix jar file into my Netbeans project while it was in my pen drive. And it worked fine while the pen drive was still plugged on.
When i removed my pen, i cannot build my project and it says that
**Could not find resource file **
Then i tried copying the jar file to my desktop and then importing it again to the libraries of my project.. It would still give the same error, and the fact i fine surprising is that it still gives the same path as it was inside my pen drive even after i imported the jar file again from the Desktop..
So i was thinking what if i can changed the path to refer the jar file manually from inside the project...
has anyone faced this problem before?
Hope someone can help me with this..
Thanks in advance

i found the answer while doing a lot of things to my project..
apparently it seems that even if we delete the jar file from the library, it somehow is still there. and that's why it gives the same path even if we import the jar file again from a different place.
here's the answer i found, just in case someone faced this
Go to Project Properties in File Menu, there under Libraries u can see all the libraries that were imported..
like shown in the above picture, the other jar files i imported previously are noted as Broken reference.. So i just removed and it did the magic =D

Related

NetBeans Include External JAR in Export to Zip

I have a NetBeans project that uses the GSON library. I've tried including the GSON.jar file without requiring future users to separately download it. However it doesn't seem to work. The project looks for the file from the relative path of my computer so the file isn't found on another user's computer. Is there a way to include GSON.jar and "Export to Zip" and keep the reference in the project itself? I'm lost!
Thank you
Exporting a Project to ZIP zips up the project folder only, and not anything outside of the folder, including dependencies. If you include the GSON.jar file in the project folder, then the JAR file will be included in the .ZIP file. It's a good practice anyway since NetBeans will use a relative classpath and thus if you move the project itself NetBeans won't give you an error message when loading the project.

Importing classes & utilities in the manifest // JNA

I'm a CS student and am in way over my head for an end of the year project, for which I need to find the dimensions and locations of a separate window. I've found that I need to use JNA libraries and understand how to do that but I don't understand how to import the JNA libraries through the manifest. Here is my file structure so far (I'm working in netbeans):
Project Folder
dist Folder
nbproject Folder
src Folder
Test Folder
Build.xml
Game.exe <-- This is the exe I run from the java file itself. I need to find this window's size and location for use later in the project
jna.jar <-- need to implement this as a classpath
Manifest.mf <-- I supposedly need to edit this.
The reason I show you this is to ensure that I've put the JNA Jar in the correct place.
Next, here is my manifest:
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Class-Path: C:\Users\justi_000\Google Drive\4. APCS\JZMinesweeper\jna.jar
So I need to edit the bit after the java -cp but I don't know what to put there, and in what order. The java tuts, etc aren't of much help.
Additionally, are these imports correct? They may be the problem and I have correctly imported everything, but I doubt that.
import com.sun.jna.*;
import com.sun.jna.platform.win32.WinDef.HWND;
import com.sun.jna.win32.*;
And, turns out, that it was a stupidly easy solution that my general incompetence caused me to miss.
Turns out it is actually possible to directly import libraries in IDEs...probably why they all include a tool for it. Blind old me has only ever used them once before (the perils of being a student) but we're all set. Simple as right click libraries>add jar.
Figured i would stick this here for future reference.

Eclipse not exporting libraries

(In Eclipse) When I right click export and export as a Jar file, it does not package the libraries into the Jar file. It was exporting the libraries a couple weeks ago and the libraries were going into the Jar file and I'm not sure what changed.
I figured it was Eclipse so I reinstalled the program and imported the workspace with no luck. I also tried on a completely different machine.
I've moved the libraries into a container in Eclipse and also tried external libraries and none of the libraries are exporting. The only thing it's exporting is the class files, .claspath, .project, and the manifest.
Any suggestions would be greatly appreciated!
Of course when you post a question you've been working on (for hours) you seem to find the answer 5 minutes later...
The file was not exporting correctly because I chose "JAR file" instead of "Runnable JAR File".

How to set reference to the folder which contains multiple jar files?

My environment:
Netbean 6.9.1
Glassfish 3.0.1
Windows 7
Goal:
When my coworkers opens the Netbean Project, the library is already referenced without them manually create library, adding jars into it and reference it.
Detail:
I created Netbean project and the project has reference to few jar files in the folder.
Currently whoever opens the project for the first time, they have to manually create library and refer it to the project.
My project location:
C:\Users\masatosan\Desktop\myProject\myApp
My library location:
C:\Users\masatosan\Desktop\myProject\lib\myLib
The myLib folder contains:
some1.jar
some2.jar
some3.jar
I can achieve my goal if I create reference to individual jar file by defining to project.properties file like below: (creating reference to sqljdbc4.jar)
file.reference.sqljdbc4.jar=../lib/sqljdbc4.jar
javac.classpath=\
${libs.restlib_gfv3ee6.classpath}:\
${file.reference.sqljdbc4.jar}:
But my case is different since I have 3 jars in the myLib folder and wanting to reference them all.
Is it possible to reference all jars in myLib folder?
Please let me know if you need more clarification.
I'm sorry, but it doesn't work that way. When you create a project, you have to add the jar files individually.
However, if you put your lib folder under your project, netbeans will refer to them via relative paths. Then when you share the project (lib directory included), netbeans will be able to automatically find the jar files when the next person uses the project. That way you only have to add jar files once.
Short of using a dependency management tool like maven (which Netbeans has good support for), this is really the best solution. It uses a bit more disk space (obviously), but that's never been a huge issue for me.
I figured how so let me share.
Tool --> Library then library window pop up.
Create library called "MyLib" which contains multiple jars.
Add "MyLib" to your project. This change will be written to project.properties file under nbproject folder.
project.properties file indicates the classpath of lib reference you just added.
It should look like something below
javac.classpath=\
${libs.Excella.classpath}:\
${libs.MyLib.classpath}
Now someone else opens the project from different machine and she just needs to do step#1 and #2, which is to create library with same library name i.e. "MyLib"
I think this is what Bill was saying originally but thought it would be helpful to give step by step instructions since I finally figured .... after long time :D

QueryDsl Intellisense / Netbeans problems

I have all the QueryDSL jars referenced from the all directory in my libraries. My problem NetBeans is not seeing the "Q"objects. They are generated to the same directory as all the other JPA entity objects with "_". Secondly if I use a "Q" object it does compile, but the editor itself does not see it and thinks it is an error.
Anyone have any ideas? I tried editing the Ant file but I failed at that as well. It does not seem that I need to edit it specifically for generation. The main problem appears to be linking to the NetBeans editor.
BTW I did look at this link and I already did this! How to setup classpath in Netbeans?
Also I have this problem on both Mac OSX and Ubuntu Netbeans.
Help is appreciated!!
Best fix that is consistent is to go to project properties and add the build/generated-sources as a Source package Folder in Sources.
I had the same problem. I did a clean & Build, on the project and that did it for me. I could clearly see the java files being generated, and the class files are not getting in the path. Clean did the trick for me.