Why this resource couldn't find error message appear? - java

I am opening a downloaded project in to my netbeans IDE. When I try to build this project following error message is appeared.
C:\Users\mymachine_name\Downloads\StoreKeeper-master\nbproject\jfx-impl.xml:1212:
Warning: Could not find resource file
"C:\Users\mymachine_name\Downloads\StoreKeeper-master\${libs.ControlsFx.classpath}"
to copy. BUILD FAILED (total time: 2 seconds)
I tried to resolve this by adding this missing controlfx jar file, But it didn't work
My project name - StoreKeeper-master

In the project folder there is a folder named library which contains all external jar files used in the project. Controlfx*.jar is also found in it. Include this jar file in your project library, then remove the ControlsFx library in the project.

the problem is netbean could not find some files to resolve it
go to properties >Library and remove the red files
watch this video https://www.youtube.com/watch?v=J4Oez0o_XUI

Related

How do I Properly Create Resources Directory Using Netbeans 11

I'm trying to utilize a resource directory in a maven project on Netbeans 11. I can't properly access the files in the resources directory when I build my code using Netbeans—however, it works fine when I build and run the code using mvn via the command prompt.
More specifically, I'm trying to load an image, bern.png, that I have stored in a directory located at /src/main/resources. When I use the following code to try and access those resources, however, I run into a NullPointerException when toString() is called on the result of getResource():
String path = this.getClass().getClassLoader().getResource("bern.png").toString();
Here is the NullPointerException stacktrace:
https://pastebin.com/KqJVxWEL
However, when I build and run the project using mvn via the command line, the project builds without issue.
Thus, the problem must lie with the way that Netbeans is viewing the resources folder that I've created.
Here is an image of my project file tree:
And here is an image of my target build file tree:
I created the resources directory by creating a New > Folder in main. As you can see, bern.png in the resources directory does not populate in the target build.
After building and running the project using mvn via the command line, however, bern.png does populate:
I've found a few articles about this, but none of them have helped. This article from javaquery refers to Netbeans 8.0, and its instructions are no longer usable as written in Netbeans 11. This StackOverflow answer refers to Netbeans 7.2, and simply creating the directory as they suggested did not function for me in Netbeans 11. This StackOverflow answer was written for Netbeans 8.0 and also did not work.
With all of that said, does anyone know how to properly create a resources directory using NetBeans 11?
The issue wasn't that Netbeans was viewing the directory incorrectly—the problem was that Netbeans 11's default Maven build wasn't recognizing the directory correctly. Switching Netbeans's Maven system to the most recent binary from the Maven website addressed the issue.
I had the same problem using a Maven project under Netbeans 11.3 for the Netty client/server framework example http2/tiles. Because using the source files from netty-all-4.1.50.Final-sources.jar, the jpg resource files were located inside the directory io/netty/example/http2/tiles together with the java files. Copying this directory to the Netbeans Maven project's subdirectory src/main/java will result in the problem, that these resource files are not included in the target jar file.
The solution is to locate the resource files in a subdirectory main/resources as it is done in the Netty Github repository https://github.com/netty/netty/tree/4.1/example/src/main. Resource files in this location are automatically added to the target jat file when the project is build.

Class not found after jar export

It should be simple but I can't run my JAR file.
My error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/pdfbox/pdmodel/font/PDFont
I'm trying to follow some post like this: Stackoverflow
But nothing.
I think this error is because I haven't take external libraries on my project.
How to create a JAR file with libraries in Intellij ?
Anyone have a solution ?
Check if your classpath includes the jar
go to File from File menu
click on Project Structure
choose Modules at the left panel
select Dependencies tab
and start adding external jars.
After adding the dependencies, you can export your project as jar if you wish.
Again go to File
Project Structure
Project Settings
Artifacts
extract Jar
If you still get the error, please cross check your classpath for the missing class, you might have got classnotfound exception or ExceptionInInitializerError before.
Click on
File -> Project Structure->Artifacts->'+'->Jar->From modules with dependencies-> Select the module folder and Main Class.Click on Apply and then you export the artifact
Now with all the required libraries in the class path your program should work as expected

archive for required library can not be read

I created my first maven project and I get Java build path problem in it.
Description Resource Path Location Type
Archive for required library: 'C:/Users/simran/.m2/repository/org/glassfish/extras/glassfish-embedded-web/3.1.1/glassfish-embedded-web-3.1.1.jar' in project 'RestfulMessenger' cannot be read or is not a valid ZIP file RestfulMessenger Build path Build Path Problem
This jar is present in the location mentioned, I tried deleteing it from there , cleaning the project and updating the maven but nothing fixed the error.
What seems wrong?
You should try doing
Maven -> Update Project and make sure you check Force Update of Snapshots/Releases
Deleting the corresponding .jar files from local repository and reissuing the maven command did the trick. It seems the .jar files got corrupted while downloading.

eclipse doesn't see java file generated during installation of maven module

I am working on a specific maven module. I have it imported into eclipse by m2eclipse plugin. The module uses our internal plugin to generate java files from some csv files. During install goal those files are being generated and put to target/generated-sources/folder_name.
Can you tell me how I can import these java files into eclipse so it stops showing me compilation errors saying that 'x' cannot be resolved to a type?
Now every module which uses those files has compilations errors in eclipse, everything works fine when I try to build from command line.
Thanks in advance.
UPDATE: Thanks a lot guys, I was trying similar solution but instead of adding source folder I was trying to add external classes :|
project -> properties -> java build path -> source -> add folder -> (search for target/generated-sources/folder_name, create it if deleted by maven) -> ok
now eclipse will only complain when you'll use mvn clean deleting target folder.
Eclipse refreshes file content on request, so any change made external to eclipse, eclipse doesn't know about that
You can make eclipse to use native hooks to detect external changes
preference > workspace > check refresh using native hooks
and add that directory to source path
You probably need to add the folder of the generated files as a Source folder in the project. Look in the Project Properties > Java Build Path > Source tab and add the folder.

Integration of external jar file in android application using adt 20

I am trying to use external jar file in android application. The jar file is running well in another java application but when I am trying to use the Jar file with Android Application by BuildPath-> Add External Jars; it is showing following errors
"could not find class referenced from method ".
Please help me out from this.
Thanks
Shorav
Maybe the ADK update has messed-up with your project's build-path. Try removing the JAR and add it again to your libs folder, and do a Clean Project.
following poster's comment about not having a libs folder:
You should try this:
Remove all references to the JAR in your project -> your code should not build without error anymore
Create à libs folder at the root of your project
Copy the JAR into the libs folder
(If still not running OK) Right click your project > Android Tools > Fix Project Propertie
If you want to use a Jar in android application you may create it like this:
Open your IDE
Click on new
Choose new Android project
Give the name of your project
Check option make this project as library

Categories

Resources