Eclipse isn't showing anything - java

The screenshot of my starting eclipse page.
So I'm very new to eclipse. I'm 16 and need it for school, I've been using it for 2 months now.
One of my assignments was to use JFrame and create a GUI which I had to import into eclipse.
However, when I created the java project and then tried to use JFrame it would show me the source(I think that's what its called) but wouldn't let me open the design part.
So then I tried to create a class in a new java project and it wouldn't show me any code so I deleted eclipse and tried to install it again.
Which I did twice and now I just get this screen whenever I open it. I can't find the project explorer and I cant use it.
Please help me to fix and get the screen back to normal with the console and terminal and package explorer visible as well as how to use JFrame properly.

Click Window > Show View > Project Explorer as shown below:
Similarly, open other views like Console, Problems, Outline etc. (whatever you need).

Related

Running Projects in IntelliJ

I've got a project from my teacher, in which i should add my implementation for a certain aspect.
The Project already got a main method but still the "Run" and "Debug" buttons in the top right corner are greyed out.
I've also tried right clicking the main method and java file, but it doesnt show me run or debug.
Also tried using the "Make Project" Button (top right corner), but it doesnt let me run it either.
How can i run the project?
Help would be much appreciated cause I cant seem to find a solution...
the "run" and "debug"-button in the top run the currently selected main-method. As long as you haven't selected one, you can't run it. In the current version on the left side of the editor-pane, there should be a green arrow right next to the main-button. Run it once via clicking that arrow and from that point on you can run/debug the program using the buttons on the top-window.
In this image you can see the green arrows (version 2016.2.4).
Alternatively, you can use the following more complicated, but also more versatile option:
Directly from the run- and debug-buttons is a button that toggles a list. In the initial configuration of the project, this list contains exactly one Item: "Edit Configurations...". Use it to create a custom-target - go for Application, if your using a java-class as entry-point - and set up the configuration as you wish. Clicking the arrow mentioned earlier does basically the same with a bit of automatic configuration.
Third alternative:
Open the context-menu on the main-method. It as well contains options to run and debug the program with the marked method as entry-point. Works for the context-menu of the respective class as well.
You have to add a run configuration. Do this with clicking the grey button and then clicking at sth with configurations (i am not in front of my PC), then add there the config
Does your main method have the proper syntax for arguments? I found that in Eclipse, the program will not let you run the main method if it is not in the format of public static void main(String[] args). Also, does your code compile properly and your IDE just doesn't let you run it?

Right Click Not Working in NetBeans 8.0.2

I installed NetBeans 8.0.2 recently, and tried to set null layout for a JFrame.
Tried to proceed but RIGHT CLICK on the frame didn't work. I am actually trying to set a background image for a frame.
Someone has already posted cannot right click on Jframe or Jpanel in netbeans 8.0 but it has no answers.
How to fix this problem? Hope that someone has found a solution.
It works for me to right-click on a JFrame and use Set Layout -> Null Layout with Netbeans 8.02. They did not remove it as an option. My guess would be that it is a problem specific to your configuration and/or installation.
Close Netbeans, delete your user configuration directory and cache directory ( see http://wiki.netbeans.org/FaqWhatIsUserdir ) and reopen Netbeans. If the problem persists use View -> IDE Log and add the Error messages from the log to your question. After opening Netbeans, only try one thing and then copy the log so you don't have a bunch of irrelevant error messages in the log.

Eclipse Not Showing Errors on Lefthand Side

So I've been using Eclipse on my mac for the past 4 months with no problems but suddenly things are acting up. Before, Eclipse would show me a red dot on the lefthand scroll bar when I was working on a class in a project. Now, for some reason, all it does is grey-out that line number but it does not show me that dot like it used to. I've tried restarting both Eclipse and my computer, I've tried working on different projects and classes, I've made sure a project builder is selected, and I've checked that the "show errors" options are all checked. I do not like having to have another window open to see exactly where all my errors are; I preferred just having the red section on my class screen. Any other suggestions?
Thanks everyone!
You could try looking here: Error indicators in file margin in eclipse indigo
Open Preferences, select General/Editors/Text editors/Annotations, and make sure that the errors/warnings are selected to be displayed in the Vertical and Overview rulers.
or
Figured it out, if you go to system preferences > general > click the "when scrolling" button, to only show the scroll bar when scrolling it fixes it. Mine was previously on "always". I restarted eclipse and it shows the errors/warning message etc now.'

Eclipse is creating two class files

When I create a new class inside a package for some reason it creates two class files: one inside of the package and one out of it. I wanted to know why this is happening? Also, at times, Eclipse are kind of "hiding" some of my classes, so that they do not appear in the project explorer, although when you create a new class file with the same name of the class that disappeared, it says the class already exists...
When I refresh (F5) the package, these problems are sort of solved. But they happen again when I create a new class or when I restart Eclipse. So I wanted a different solution from keep pressing F5 everytime...
So I had this same problem and it may be for the same reason. The problem can be because you are creating the .java files in the Project Explorer window. Close this window. Then, go to Window -> Show View -> Package Explorer. Then create your .java files there. The issue is that the Project Explorer window looks EXACTLY the same way as the Package Explorer.
#Rammohan's answer helped me but I can't vote it up or apparently add a comment because of low reputation. Being new to Eclipse I didn't get what he meant at first, so wanted to add a little detail for other people.
From the top menu it's Window -> Perspective -> Open Perspective -> Java.
I had unwittingly switched to the Debug perspective and had the double-creation problem happening in src/test/java (but not in src/main/java, still don't get why). Switching to the Java perspective cleared it right up.
I also had same problem with eclipse. This issue is resolved after changing Perspective mode from "Debug" to "Java". Two same class files appear when Eclipse Perspective is in "Debug" mode. In "Java" perspective, this issue is resolved.
Hope this helps if someone facing same issue.

Netbeans JApplet Webstart - icons not appearing on button when run

Hey there - just wondering if anyone knows the trick to getting icons to display on button in a JApplet. When I add the icon from a png in my package via the properties panel it turns up in the NetBeans IDE as expected but when I run the launch file it isn't there. I can confirm that the file exists in my Jar and no exceptions seem to be thrown in relation to missing files.
If I create a similar application using a JForm and run it directly from NetBeans the icon appears as expected.
EDIT:
It seems this is confined to Chrome... works correctly in IE9 and FF 3.6
EDIT:
Replicate as follows - no coding required:
Create a NetBeans 6.9.1 Project with the following settings:
Java --> JavaApplication
[Next>]
Name e.g. JavaApplication1
Untick "Create Main Class"
[Finish]
Add a png image "MyIcon" to the src directory.
Right Click "JavaApplication1" Project in Projects panel and select New -> JApplet Form
[Finish]
Drag a button onto the form, right click -> properties -> icon and choose "MyIcon" from the pre-populated dropdown menu. You should see the icon appear on the button in the IDE.
Build the project, then navigate via explorer to the dist/launch.html file and run it in Firefox or IE and the icon will be there, run it an Chrome 10 and it won't.
It seems this problem magically went away and now I wish I had noted the exact version of Chrome that I had so that I could tell whether it updated or not. I worked around the problem but inadvertently left an icon on a button - I started work again today on my project and how-you-doing there was a lonely icon on a button - there are three possible reasons why this happened:
1 - I shut down my machine overnight; aka restart (93% Sure this was it)
2 - I moved the entire Netbeans project to another directory (5% Sure this was it)
3 - maybe but unlikely Chrome updated itself with a fix (2% Sure this was it)

Categories