NetBeans error: package org does not exist - java

I just installed Netbeans IDE. I am now unable to import any org.* libs and it just says package org does not exist.
Also, I imported jdic.jar into the project and even though the code completion suggestions show up as org.jdesktop.*, it shows the same error.
How do I fix this?

Clearing the cache fixed it.
In windows 7 the cache is located in
C:\Users\username\AppData\Local\NetBeans\...
On Linux, the cache is at:
/home/username/.cache/netbeans/...
On clearing the cache, and restarting netbeans, it started to recognize org.* imports again.

I did it easily, just click the Jframe, on Navigator tab, right-click -> Set Layout -> Absolute Layout and YEP, It works for me.

org.netbeans.lib.awtextra is part of the AbsoluteLayout library. It should be added automatically by the ide whenever absolutelayout is used in the form. But if you switch to some other layout after using absolute layout, then the jar/library will be removed from the classpath and existing code making calls to the library will not compile.
If you would like to use absolute layout, then please include the library in the project. Select 'Libraries' node in the project, right-click and select 'Add Library' and select 'Absolute Layout' library from the list of available libraries.
If you do not wish to use absolute layout, then it is best to uncomment/remove code relying on the library and re-do the form design using the new layout.

Can you try importing
import org.xml.sax.Attributes;
This is part of the JDK. If you can't find that, something is really wrong.
I suspect you need to add the libraries to your maven pom.xml file.

You should redirect all the lost .jar files by exiting netbeans, then reopening it. There should be a prompt asking you to help the IDE find the .jar files. So please do so. If you aren't able to find the jar file. Clean and build the individual packages. There a new directory called a dist directory will be created in the package directory. Now you can redirect them.

Above was not working for me so I tried below and its working:
Google "absolutelayout.jar download"
Download jar
Open NetBeans and Add this "AbsoluteLayout-RELEASE***.jar" file to your project Library folder.
now try to run the project/file

in my experience the problem was with a Jpanel with AbsoluteLayout, I put free-design and solved the problem

Related

IntelliJ IDEA not recognizing JavaFX library

I am attempting to create a JavaFX project using IntelliJ IDEA. The instructions for doing so appear here: Create a new JavaFX project. This issue is, I am encountering a popup that does not appear in the official instructions, and it is preventing me from using the library.
This is the step I am having trouble with:
However, when I select the lib folder, I see this popup before I am allowed to proceed and pick a module:
No matter which option I pick, the classes from that library are still not recognized in the program. What do I do?
Edit: The lib folder is not empty, so that can't be the cause of the issue.
When you go to the lib folder select all .jar files and src.zip file then press ok. You have to manually add all files in the lib folder.

How to solve the path to an imported JAR file (NetBeans 9.0)

Introduction
I am using NetBeans 9.0 with imported libraries (JAR files). Some of those I downloaded from a school's computer and others from home.
Problem
When I want to do the build it shows an error that it can't reach the library, even worst, I can not even remove libraries by some reason. Not even "manually" (enter the file's project and manually delete it).
In this picture you can see the build error log for some imported libraries (jsoup and jfreecharts) which by some reason can not be read.
On the right of the image you see the Edit for JSoup which shows a different path to the JAR file.
Question
Why is NetBeans still looking for the previous path?
How I am supposed to solve this path problem when I can not even remove libraries?
How I can avoid this problem in the future?
Not using NetBeans won't be accepted as an answer.
Thanks for your interest and time.
Head over libraries in your project
Right click on it with your mouse and then into properties
This will set you into Categories: -> Libraries.
(Already solved the path issue that is why there are no red paths here)
There you can see all the classpaths of your libs and if those are correct. Delete those which are on red and reimport the JARs into your project.
Click on the path you want to delete and press Remove
This will solve the issue AND be able able to delete libraries that you are not using anymore.

Cannot get JavaFX to work in Eclipse

I'm trying to use JavaFX in Eclipse but whenever I use any of it's Classes it doesn't recognize the type. To clarify I get the message "Dropshadow cannot be resolved to a type"
This happens not only with Dropshadow, but with any of the JavaFX classes. The IDE won't give me an option to import it and when I try and to type it in manually it isn't recognized. In using JSE 8u25, which apparently has it included.
In looking around I see that the .jar file can be added manually, but I would like to know if something within my IDE isn't configured right, because it should be working. Can anybody give me a hand with this? Thanks.
So I finally got it working, the solution was to install the eclipse plugin found here:
http://www.eclipse.org/efxclipse/install.html
The directions are pretty good, I just followed them as written and got it up and running.
Adding to Build Path
Your problem here, is that you just dropped your .jar file right in there, and tried using it. You need to add it to the project. To do so, follow the below steps:
Add the .jar file to your project folder (not src) via. copy/paste or simply drag/drop.
Right click on the .jar file once it's inside your project.
Press Build Path > Add To Build Path
What you have/will done, is adding the .jar to the project itself. Theres a difference between having it in your project, and having it a part of your project.
Now you can import, extend, implement, whatever you need.
Removing from Build Path
Ok, so you found a better library for what you want, no longer need the library or made your own, and you want to delete your .jar.
Well, firstly, it's still a part of your project, so you need to remove it from the Build Path first.
Right click on the .jar file.
Press Build Path > Remove from Build Path
Your .jar is still inside your project, but no longer a part of it.
Now you may go ahead and delete it without worry.
The simple way to solve your issue is to right click your project, go to properties > java build path then select the tab where it says Libraries.
You have to select that library you have in there > click the button EDIT then select from there Workspace default JRE . You need to have at least java 8.

jar file is not working in the dist (swing project by netbeans )

I set a lookAndFeel synthetica theme for the project.After that it is not working(jar file in the dist).
Again I removed it and tried.Then it worked. I did clean and build.
Tried several themes. They all workedd in the project. But did not run in the dist.
What should I do? Please help me..
I have experienced this before in my projects. Most of the time it happen because of using icons and images.
When /Icons/calculator.png image in your package, it is not wrong in netbeans like this getClass().getResource("/Icons/Calculator.png").
this is working on netbeans. but not in jar file. you need to rename Calculator.png.
use jar file in console (CMD in windows , shell in linux) with this command
java -jar adress-jar-file/jarfileName.jar
then see error in console.
Just Right click on yoru projet in netbeans and select Set Configuration then Customize in the window that appears provide your Main Class by clicking the browse button or writing it manually and Clean and Built again
Plz make sure some points.
1) You have set main class properly.
Right click on Project-> project properties-> Run-> set Main-Class
2) You have set theme path properly.
3) Your themes are not corrupted.
4) You have build your jar properly.
Right click on project-> clean and build(Note: Do nothing while it finish building jar)
5) Your lib folder not corrupted (if it is present).
It looks like there maybe something wrong with your setup. In your project properties, under libraries have you by chance added synthetica.jar as a required jar. but m not sure try it
but you can simply do,
you could create lib folder manually in your project folder and then paste that jar in that folder then through netbeans go to your project then right click on libraries and then browse to find your project folder open that then click on lib folder that you have created open it then click on jar that you have pasted and that jar file will be added to your project.
I could resolve my problem.I'm sorry that I was used trial version Synthetica.jar. after I bought it and done every thing from the beginning. I resolved it. Thank you for your contribution to resolve it.thank you

Building Android Source apps In Eclipse

I downloaded the source to spareparts here
https://android.googlesource.com/platform/development/+/gingerbread-release/apps/SpareParts
It includes Android.mk, AndroidManifest.xml, Notice, res and src folders.
My question is how can I compile this source code in Eclipse? I see there is a make file (Android.mk) which I'm guessing I need to use but I can't figure out what to do to get this thing imported into Eclipse without having 500+ errors.
This article seems to have the answer. According to it you would need to download all of the source just to build one of the apps, though.
Brute force always works :)
Create a new android project in Eclipse named SpareParts
Use the explorer to replace both the src/ and res/ folders inside workspace/SpareParts with the ones downloaded form git
Click with the right button on the SpareParts entry in the project tree in Eclipse -> Refresh
enjoy
I looked into the files and it does not seem that it uses any external library.
If you try to build it by itself, you will still have problems due to these three classes that are not in android.jar:
import android.app.ActivityManagerNative; //cannot be resolved
import android.os.ServiceManager; //cannot be resolved
import android.view.IWindowManager; //cannot be resolved
In Eclipse try File->Import... and General->Existing Projects into Workspace, add the project folder and then try to compile it. Hope it helps.

Categories

Resources