Related
I created a new web project on Netbeans. As usual, in order to be sure that everything is OK before coding, I tried to run my project directlywith Netbeans.
For what I can see, evrything is great, except that I have a popin with the followed message : "Cannot run /usr/bin/firefox". A fex months ago, running a project by this way was perfectly good. I don't know what has changed.
What I tired/checked :
The file /usr/bin/firefox exists ;
I give it all the rights (reading, writing, executing) ;
if I specify another browser in Netbeans, the result is the same (of course, the message changes but keeps the same format) ;
My firefox is pefectly running, excpet for that.
I'm currently on Debian and Firefox v45.9.0.
Do you have any idea of what could cause this problem ? Any help is welcome !
Marine
Go to Netbeans menu Tools > Options. In the General Tab, Web browser section tab click edit.
Select Web browser as firefox (I guess it is already like that for you).
On the right hand side, if the text in Arguments section is -remote "openURL({URL})" , bingo that could be the problem.
Change it to {URL}.
Save and try running the project. Hope it works..
I'm trying to migrate from Eclipse to Android Studio. There are a few things that bug me, but one stands out:
Q1: Is there no way to do automatic builds and have a list of problems displayed immediately like in Eclipse?
I know, there are many refactoring tools, but my often-used practise is to just insert a character into the name of a method and variable and check problems-view to see where it's being used.
Q2: How can replace or replicate this workflow in Android Studio?
One thing you can do is deactivate the external build. To do so click on "compiler settings icon" in the "Messages Make" panel that appears when you have an error. You can also open the compiler settings by going to File -> Settings -> Compiler. (Thanx to #maxgalbu for this tip).
enter image description here
Uncheck "Use External build"
enter image description here
And you will see the errors in the console
EDIT: After returning to "internal build" again you may get some errors, you can solve them this way: Android Studio: disabling "External build" to display error output create duplicate class errors
I got weird java error. When I try to run my code there appears window with:
Could not find the main class..
I have tried to reinstall java, but it
didn't help. Path to /bin directory is set properly. Can you help me ?
It happened with friend before and the reason was selecting right jre within project setup stage.
When you setup your project be sure you selected your right JRE -> Use a project specific JRE :jre1.8.0_31 something like this.
Isupposed that you have main method , also you did not delete or miss up with your source files.
So I'm making a java application in Neatbeans 7.4, been working at it for a while, everything was fine, running the project worked fine, but now when I hit run project, I get the error
Error: Could not find or load main class phleveledit.MainWindow
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
I can't think of what I did right before this started happening, so I don't know what I should change.. The code doesn't appear to have any errors. Here's a screenshot of the IDE+project folder
Image (http://puu.sh/5ldYB) :
Any ideas?
Edit: Unfortunately I happened to fix this problem by removing some code, which probably had some errors Netbeans couldn't detect, but I don't know what was exactly wrong so can't vote on a correct answer.
Right click on your Project in the project explorer
Click on properties
Click on Run
Make sure your Main Class is the one you want to be the entry point. (Make sure to use the fully qualified name i.e. mypackage.MyClass)
Click OK.
Clean an build your project
Run Project :)
If you just want to run the file, right click on the class from the package explorer, and click Run File, or (Alt + R, F), or (Shift + F6)
Just close the Netbeans. Go to C:\Users\YOUR_PC_NAME\AppData\Local\Netbeans and delete the Cache folder. The open the Netbeans again and run the project.
It works like magic for me.
(AppData folder might be hidden probably, if so, you need to make it appear in Folder Options).
You can :
RightClick on project node and go to Set configuration
Select the main class for your application.
Then clean and build.
Even if the above steps don't work for you then then delete the Netbeans cache by deleting the (index) folder
User\.netbeans\SOME_NUMBER_reflecting_your_version\var\cache\index\
Sometimes due to out of memory space error, NetBeans does not load or find main class.
If you have tried setting the properties and still it is not working then try
Select the project from the project explorer
Click on Run in the Menu Bar
Click on Compile
It worked for me.
This condition happens to me every 6-months or so. I think it happens when closing NetBeans under very low memory conditions. I discovered that it could be easily corrected by (1) Rename your project, including its folder name using right-click on project explorer's project name---I put a simple suffix on the original name ("_damaged"). (2) Try BUILD. If that is successful, which it is for me, give three cheers. (3) Repeat step (1) to restore the original project name. BUILD and RUN should start without trouble.
I guess that the 'rename the project and folder' process causes a special rediscovery of the applications main location.
Try to rename the package name and the class/jframe names... The clean and build the application.
Right Click on the package name
Go to Refactor
Select Rename
Give it a meaningful name, preferably all in small letters
Click on Refactor
Do the same for the class/jframe names.
Last Select Run from Menu
7.Select Clean and build main project
That should do it!!! All best
I had the same issue once. The problem was not in the code. The cause was... renaming the project folder to some other non supporting name. My project name was "MobStick" and I renamed it to "MobStick - May 26, 2014 04:00PM". Renaming it back to normal solved my problem.
I have run into this error a couple of times as well and for me the above solutions did not work. What does seem to work is going to the Project Properties, and under Compiling toggling Compile on Save.
Using NetBeans 8.1, I got the dread
Error: Could not find or load main class
from carelessly leaving an empty line in the Project Properties > Run > VM Options field. Until you click in the field, you may not see the caret flashing out of place. Remove the empty line to restore equanimity.
I just ran into this problem. I was running my source from the command line and kept getting the same error. It turns out that I needed to remove the package name from my source code and then the command line compiler was happy.
The solutions above didn't work for me so maybe this will work for someone else with a similar problem.
I had the same problem, I had the package and class named the same. I renamed the class, then clean and build. Then I set the main class in the "run" under the properties of the project. I works now.
I found the following steps useful:
Right-click on the project in the left toolbar.
Hover over the 'Set Configuration' item.
Click on 'Customize...'
Click on 'Browse...' by the 'Main Class:' item.
Select the correct class.
Click 'Select Main Class'.
Click 'OK'.
My problem was that, apparently, my package name was being listed twice. Selecting the class using the dialog changed 'aclass.MainClass' to just 'MainClass'.
Hope this helps,
-HewwoCraziness
Edit: This is expanding on Mary Martinez's answer.
You can solve it in these steps
Right-click on the project in the left toolbar.
Click on properties.
Click on Run
Click the browse button on the right side.(select your main class)
Click ok
Possible Fixes:
Fix 1
Go to project properties (right click on the folder of your project in netbeans)
On left tab where it shows the categories, click on the "Run" selection
Then click on Browse to find the Main class you use on your project
Fix 2
Go to C:\Users\name\AppData\Local\Netbeans
delete the Cache folder.
Rebuild and Run
Fix 3
Download most recent version of Netbeans
Fix 4
Download most recent version of JDK and configure Netbeans to use that
I had the same problem for 3,4 days. On my PC my Jar file snapshot would give me this error while on my laptop it would work fine, I tried all the tricks shown above and on other forums like deleting cache, selecting main project file, etc, but somehow I was sure the reason it cannot find the main class when I would execute the JAR file was may be due to classpath issue in maven configuration, and I was right and I fixed it using following steps:
Right-click on the project, and go to the properties
Inside the properties go to Actions
On the right side in Actions select "Run Project" and you will see properties below
Inside "Set Properties" make sure exec.args=classpath %classpath "package_name"
In my case, the package name was accompanied by the main class. So my main class was Login while the package name was com.mycompany.islamic_center_app1, When I checked the entry was
com.mycompany.islamic_center_app1.Login
All I did was remove ".Login" from com.mycompany.islamic_center_app1 and it was fixed, no more errors.
close netbeans.
open netbeans again.
choose new project>>java application.
click next.
deselect create main class.
now make the application
clean build run
For more reference watch this video
try this it work out for me perfectly
go to project and right click on your java file at the right corner,
go to properties,
go to run,
go to browse, and then
select Main class.
now you can run your program again.
I had the same problem and I moved the project to a location where the path had no none-english letter and that fixed the problem
if you are on window os, then try to start NetBeans via administrative mode. right click on NetBeans icon and "Run as Administrative".
If none of the above works (Setting Main class, Clean and Build, deleting the cache) and you have a Maven project, try:
mvn clean install
on the command line.
Had the same problem here. Usually Clean and Build solves much of the problem. It happened to be caused by a wrongly installed plugin.
I faced the similar issue with Netbeans 10 and JDK 1.8.
I was not able to choose the right class to launch the project
When I compile or run the project, it shows me the Class name as "initializing view, please wait ...", I could not select the class name.
The issue was resolved with the NetBeans11.3, I am able to choose the correct Class file without any other changes, and the project is launched without any issues.
I had the same issue but none of this thread's solutions worked for me. Finally, it was OneDrive that caused the issue (for once more). So, I simply moved the NetBeansProjects folder from Documents which is synced with OneDrive, to C:\Users\yourName\AppData\Local\NetBeans (selected this path as there is already a NetBeans folder) and that was it, case closed.
If you also have NetBeansProjects to a OneDrive syncing folder it is worth trying this solution, just be sure that the path you will select is not synced with OneDrive. Also, remember to close Netbeans before making the folder change and after you move the folder to the new path you need just to open Netbeans again, go to file menu/open project and select your project from the new path.
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).