I have a JavaFX project that I have been programming in NetBeans. I'm using a version of a JAR file in my libraries and a newer version has come out. I tried to remove the first version and then add the new version in by right clicking the Libraries and then clicking "add JAR/Folder." It adds just fine but then all my imports will not resolve to the new version. I get errors saying that the import can not be found and none of my methods that use that library can find their objects either. If I right click on the little yellow lightbulb on the left, normally I would get an "Add import for ________" But that doesn't even show up. Only "Create class ______ in _______." I know the actual objects haven't changed names and the imports are pointing to the right locations, none of those have changed either. If I add the old library back in it works fine.
Is there a way to update the library. Something like "Refactor to new JAR?"
After looking into it some more and doing some extensive trouble shooting. I figured out that the update was a bad file. By using a slightly earlier version of the jar file but still newer then the one I was using I got it to work. Guess I just need to wait for the developer of the "Update" to fix their file. Thanks guys
Hello guys I am new to programming.
I used NetBeans first but didn't like the UI.
I switched to IntelliJ.... but while creating forms in Netbeans some code was auto generated like the button info etc etc.
I would like to have the same in IntelliJ but can't find this feature anywhere. Can you guys please help me?
Most likely the generated code made by NetBeans vs IntelliJ will be different, and there isn't much you can do about it. By default IntelliJ will not create actual code for auto-generated UIs, but instead will create binary files that will directly create a class file for a UI class at compile time. You can modify this setting, however it does not guarantee that it will be the same as what NetBeans generated, or that it will be parsable for use in IntelliJ's swing designer, so just be aware.
To answer your actual question though you can change from binary files to generated Java source files via the following:
File -> Settings -> Editor -> GUI Designer.
Modify the item named "Generate GUI into" and set it to Java source files.
Take a look at this section of the IntelliJ manual: https://www.jetbrains.com/idea/help/gui-designer.html
In IntelliJ with the ASM Bytecode plugin installed you can select "Show Bytecode outline" in the popup menu when viewing a class file. Recently my IntelliJ (Community Version 12.1.6) started displaying:
// couldn't generate bytecode view, no .class file found
in the ASM window.
This occurs on various class files across different modules in my project. The strange thing is that I will get this message for one class; but another class in the same module and package works fine.
The entire project compiles fine and all my tests run. I cannot figure out why I get this message for one class and not another.
I have had the same problems after moving to IDEA 12 but my "positive hit rate" for being actually able to view the byte code outline became more stable again after upgrading to version 13. However, the result is still rather dissatisfying. From the logs, I learned that the plugin seems to not being able to find the referred class files even though they exist. It helps to make the project before trying to view the files, but this is not a perfect solution either. I guess, the problems will stay until someone sufficiently annoyed (maybe you?) upgrades the plugin.
What I use for now is simply javap from IntelliJ IDEA. You can add external tools by doing the following:
Settings > External Tools > Add...
Set the javap location for the called program: For example C:\Program Files\Java\jdk7\bin\javap.exe on Windows, depending of your installation path.
Add -v -c $FileClass$ as the parameters (here you can of course set the parameters you actually require).
Set $OutputPath$ as the working directory.
Now you can use javap from the right click menu on the source code view and you can also define a shortcut for the command.
Per Andrey Breslav's comment, the correct resolution to this issue is to use the "Show Bytecode" command in the "View" menu. You must have the source file open for this command to be displayed. You must have compiled the source since the last change for the command to complete successfully.
I am trying to refactor my package using Eclipse
org.sheehan.activity
to
org.sheehan.stocks.activity
For some reason my project just blows up when I do this and R doesn't get regenerated. How can I refactor properly?
UPDATE:
I updated my Android Manifest to reflect the change. R still doesn't get regenerated. Even after a clean. The compiler is complaining about org.sheehan.activity.R
I resolved by:
Android Tools > Rename Package Application
If you renamed properly, all your references across your project should have gotten updated. After doing this, clean your project by going to Project > Clean. This should fix it.
Fixing missing reference to R in eclipse:
Refactor -> Rename`
Build -> Clean
Android Tools -> Fix Project Properties
select the base package of your project in the eclipse package explorer, press F2 (Rename), in the rename dialog: SELECT ALL the checkboxes.:
That should do it
The package name doesn't update in the XML files. Specifically your manifest which needs to know the base package.
For more advanced imports and refactors, literally closing the Eclipse IDE can refresh a cache that causes random errors like "End position lies outside document range" or the "what once worked now doesn't hair puller outter errors."
Signs you should close Eclipse when trying to rename things are:
When you import a project, do some refactoring (like trying to change the package name), then delete the project and try again, you will see immediate R.java errors when you didn't before
When you are importing projects that have manually generated R.java files that have custom imports like "com.ns.proj.R" and don't see the name update in Preview
The box that asks if you want to "Rename subpackages" is checked unexpectedly
the code in the "Preview>>" looks as if it's been complied before instead of black and white code with the proper names replaced
you get XML errors in the manifest activity name like this
android:name="com.ns.proj.CustomCocom.ns.proj.CustomControlse="#android:style/Theme.Light.NoTitleBar"
when it should be
android:name="com.ns.proj.CustomControls"
android:style="Theme.Light.NoTitleBar"
There are too many to name obviously, however this is as important as "keep your eye on the ball" in sports. Something that is so easy to forget, yet things like these apply to other software programs like Dreamweaver (e.g. when you use the Dreamweaver "Put" option instead of FTP dragging with FileZilla and you notice your domain isn't updating your changes online). I called Adobe when I first started as a developer 8 years ago because I knew I wasn't doing anything wrong. They said sometimes the generated files to perform the action get corrupted...in other words, IDE's have bugs too!
In general, close the IDE before you off yourself...it could save your life!
Right click in your Project, go to
Android Tools > Rename Package Application
Sometimes if Project > Clean doesn´t work, so Delete /gen and /bin folders of your project.
I've downloaded, unzipped and setup Eclipse 3.4.2 with some plugins (noteable, EPIC, Clearcase, QuantumDB, MisterQ).
Now I find when I'm editing Java projects the code completion is not working. If I type String. and press ctrl+space a popup shows "No Default Proposals" and the status bar at the bottom shows "No completions available".
Any ideas?
Try restoring the default options in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'
An example of the kind of data you see in this preference screen, however not necessarily what you currently have.
(From Vadim in this blog post " Content Assist Duplicates in Eclipse (Mylyn)":
if have duplicate Mylyn entries, uncheck the duplicate entries that do not contain "(Mylyn)" in their name)
The Eclipse help page defines the default list to restore:
Select the proposal kinds contained in the 'default' content assist list:
Other Java Proposals,
SWT Template Proposals,
Template Proposals,
Type Proposals
I'm adding an answer here in case someone else finds this on Google. Same symptoms; different problem. For me, the type caches had become corrupt.
From http://mschrag.blogspot.co.nz/2009/01/open-type-cant-find-your-class.html
Quit Eclipse
Go to workspace/.metadata/.plugins/org.eclipse.jdt.core
Remove *.index and savedIndexNames.txt
Restart Eclipse and search Ctrl+T for the offending type. The indexes will be rebuilt.
In case someone comes here and want to activate the autocomplete function, go to
Preferences -> Java -> Editor -> Content Assist.
Then in the Auto Activation section fill in Auto activation triggers for Java:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ._
For those running Xfce + having IBus plugin activated, there might be keyboard shortcut conflict.
See more info on my blog: http://peter-butkovic.blogspot.de/2013/05/keyboard-shortcut-ctrlspace-caught-in.html
UPDATE:
as suggested by #nhahtdh's comment, adding the some more info to answer directly: IBus plugin in Xfce uses by default Ctrl+Space shortcut for keyboard layout switching. To change it, go to: Options and change it to whatever else you prefer.
Check the lib of your project. It may be that you have include two such jar files in which same class is available or say one class in code can be refrenced in two jar files. In such case also eclipse stops assisting code as it is totally confused.
Better way to check this is go to the file where assist is not working and comment all imports there, than add imports one by one and check at each import if code-assist is working or not.You can easily find the class with duplicate refrences.
Another solution which worked for me is to go to Java--> Appearence --> Type Filters and do disable all
None of these worked for me.
I was experiencing this issue in only once particular class. What finally worked for me was to delete the offending class and recreate it. Problem solved... mystery not so much!
If you have installed Google Toolbar for IE, may be you can face the same problem. Because, the toolbar capture the shortcut ctrl+Space.
I had this problem and like #Marc, only on a particular class. I discovered that I needed to designate Open With = Java Editor. As a Eclipse newbie I hadn't even realized that I was just using a plain text editor.
In the package explorer, right-click the file and chose "Open With".
I faced this problem, and spent hours trying to figure out the issue. tried to follow the steps mentioned in the different answers above, the solution I found is on the same lines as Mona suggested, but slightly different. Tried to add as a comment to Mona's answer but no option was available.
Issue with my eclipse was, classpath somehow got corrupted and all the jars and dependent projects were missing. after taking the latest .classpath from repository it worked fine.
Check that you did not filter out many options inside the Window > Preferences > Java > Appearance > Type Filters
Items in this list will not be appear in quick fix, be autocompleted, or appear in other various places like the Open Type dialog.
I also face this issue but it is resolved in different way.
Steps that I follow may be helpful for others.
Right click on project (the one you are working on)
Go to Properties > Java Build Path > JRE System Library
Click Edit... on the right
Choose the JRE 7
Once you have you configuration checked and completion is still not working:
make sure you have the right directory structure.
Do you see the right icon beside the file?:
It will tell you how the file will be treated by Eclipse:
I am posting this answer as I had that story with with Maven webapp artifact. By default Maven-WebApp does not create folder for sources and I put my Java into resources, wondering for 5 minutes what was going on... :)
Running STS on Java Spring Boot projects, here's what works for me :
Maybe this helps other people who come across the same issue.
My setup: old Gradle project (version Gradle 2.12) made by someone else, imported using the Gradle Import Wizard into STS (Eclipse Oxygen.2 (4.7.2)).
Code completion did not work either (and I still have hollow Js at the Java files), but at least I got the code completion to work by doing:
right click on the project folder > Properties > Gradle > Configure Workspace Settings > Java > Editor > Content Assist > Advanced
check "Java Proposals in upper window.
2x Apply & Close
I have run into this problem since upgrading to Eclipse 2019-09. Based on some of the suggestions above, this is what worked for me.
I had to go to Eclipse -> Preferences -> Java -> Editor -> Content Assist -> Advanced.
I found out that if I turn on any of the key binding proposals, Java Non-Type, Java, Java (Task-Focused) or Java Type proposal, then I was able to use auto complete. If I turned them all on, then not only did auto complete work, but I got duplicate methods listed. I am guessing, but I will probably used Java Type Proposals. Any clarification of what differs for these four types would be appreciated.
In my case, Intellisense had only disappeared in a few classes in one project. It turned out this was because of a missing library on the build path (although it worked previously).
So definitely check all the errors or problems in Eclipse and try to find if a library may be missing
For those who use the latest 3-19 eclipse build:
It just happened to me when upgrading from Oxygen to 3-19 eclipse version, so I assume the auto-complete feature does not migrated correctly during the upgrade process.
The only solution that worked for me was to create a new eclipse workspace, and import the project/s to it. It might take a few minutes, but it worth it - comparing to the time spent on other solutions...
I ran into this and it ended up being I was opening the file with the text editor and not the java editor.
For me the issue was a conflict between several versions of the same library. The Eclipse assist was using an older version than maven.
I had to go to the .m2 directory and delete the unwanted lib version + restart eclipse.
I experience problems on Eclipse Neon when editing a file which does not belong to the project directory. When I copy the same file to the project root directory, not even to the src directory, the completion starts working.
When the file is opened from a different directory, only completion for JRE works. That is for example: java. completes, but junit. does not.
Just in case anyone got to a desperate point where nothing works... It happened to us that the content assist somehow shrunk so no suggestion was shown, just the "Press Ctrl+Space for non-Java..." could be seen.
So, it was just a matter of dragging the corner of the content assist to enlarge the pop-up.
I know, embarrassing. Hope it helps.
Note: this was an Ubuntu server with Xfce4 using Eclipse Oxygen.
If you're experiencing this in an enum, or when initializing an array with anonymous classes, it's a known bug in Eclipse. See Eclipse content assist not working in enum constant parameter list.
We can change the settings as per our requirement.
Suppose we want to make java proposal as highest priority we need to do changes as shown below.
Windows > Preferences > Java > Editor > Content Assist > Advanced
Choose Java proposal and click on up button
For me in Sep 2021 it was an odd Eclipse bug. I had a multi-line string inside an annotation in my Class. This caused just that particular class to fail when trying to code complete (even though the class compiled just fine).