Just installed Eclipse, won't run programs or show errors - java

new here, but I've got a simple question.
i have just installed the Eclipse Indigo IDE program on my laptop from my college website, as well as the Java Runtime Environment. While Eclipse itself is working and showing code, it won't run, every time I click on the run button, its says "The Selection can't be launched, and there are no recent launches". It also won't show any errors in the code either. This isn't a one time thing either, as I also downloaded it onto my home computer and it has the same problems. I get the impression I need to further configure it but I don't know what to do, can anyone help?

Related

How to work with NetBeans IDE 8.2 on Windows 7 64-bit with JDK

I've been having trouble using NetBeans IDE 8.2 with JDK on Windows 7 64-bit. NetBeans can compile code, but doesn't run it. I've downloaded all of the necessary files and programs and even consulted with a computer programming teacher, but I haven't been able to work around this issue. The URL displays an image that shows what I get back after attempting to run a code.
https://i.stack.imgur.com/RsEvx.png
I appreciate any help I can get.
Thanks,
--Sam
JavaApplication1.java is still set as your main class.
To change your main class, go into Project Properties -> Run and change "Main Class" to TestClass.java.
Essentially, the compiler is still running whatever main function is found in JavaApplication1.java.
#notyou Also mentioned how you can right click a file and run it directly, instead of changing the project settings. I used to use this but it slipped me! This is super useful.
I'm pretty sure this question has some answers for you.

Eclipse not opening on windows 8.1

So a couple of days ago i bought a new laptop, since my old one was way to old.
It came along with windows 8.1, which was the first time i used them since i was always with 7.
I downloaded the adt bundle that i used in my old pc, and when i attempted to open eclipse, i got the usual message about JRE/SDK missing, pretty logical, since i hadn't installed java.
So i went on and downloaded the latest java version (Java 8 update 60) and after i installed it eclipse refused to open at all. Absolutely nothing appears, not even the message that appeared before installing Java.
The fan starts working, like the program was running but absolutely nothing appears, it's not even on the processes on ctrl+alt+delete.
So are there any ideas on what might be causing this? It's a brand new laptop and eclipse flat out refuses to open. No error message, nothing, just eclipse not opening at all.
tried re-installing, running as admin, restarting, nothing works.

Java not compiling changes in my code

I have this problem with both Netbeans 8.0 and Eclipse. In Eclipse when I can write a Java program and it will compile and run fine. Then I can make a change to the source and when I run it again sometimes the old version of the code without the change in the one that is run. If I hit run a second time the new version is run.
In NetBeans I get a different error the second time I try to run updated code. "Could not find or load main class". This happens sometimes when I make changes to the source. I think this might have a similar cause to what is going on in Eclipse. In both cases the problems are intermittent and difficult to reliably reproduce.
I am using JDK 7 but before I was using JDK 8 and had the same problem.
I don't know about netbeans but in eclipse if you change code and you don't save before launching sometimes it executes the old code. So ctrl+s or hit the button save before launching every time. It seems that the run and save command are not issued by eclipse in the same order so it runs and saves at the same time but runs the old code.
i don't have the rights to comment right now so here it goes, i faced the similar problem when i was using net-beans 8.0. the main reason behind this problem is your classpath.("could not find or load main class").one way to ignore this problem is to set the classpath as the current directory(which can be done by using " set classpath=*;".). kindly revert if this doesn't solve your problem.
p.s: try it to compile with dos.
"C:\Program Files\Java\jdk1.8.0_05\bin" and you are good to compile.
and in eclipse, when the present src code has some errors.. it tend to compile and run the previous code.

Source not found Error in Java Eclipse

I'm fairly new to Eclipse and I'm using Kepler with EGit right now but I ran into a problem every time I compile my Java application. I've searched this forum to find a solution for my problem but I am still very confused as to what I can do to fix it. The application worked flawlessly yesterday morning and it works fine on my project partner's laptop but after syncing the project with 4 new commits from my project partner today, I keep getting a Source not found error every time I try to run the application. I get a button saying Edit Source Lookup Path and when I click on it and expand the folders, I get something that looks like this:
There are a bunch of .jar files above what you see and maTKProject is the name of my project.
If anyone could give some insight on how to fix this problem, I would greatly appreciate it!
When running the application in debug mode make sure that there aren't any breakpoints that shouldn't be there. Go to Window -> Show View -> Breakpoints and remove as necessary!

Eclipse (SWT composite): How to run and where is build?

I am new to Eclipse and Java programming having mainly worked with Microsoft Visual Studio.
I installed Eclipse (Kepler 4.3) with no issues along with WindowsBuilder and SWT.
I created a new project adding in references to SWT, both WindowsBuilder JARS, and resty. Into the project, I created a new package and selected a SWT composite. I gave appropriate names.
The GUI designer came up with no issues. I added in a couple of controls. The idea is to create a hello world application, display that application, and build it. Eclipse has automatically build checked.
Okay, the IDE in designer view shows the GUI of my Hello World application and the source view the source, so no problems there.
I press Run, and the first time I had to select a run configuration, which I selected EclipseStarter. There was not many options. I click on run and nothing happens.
If I go to the project's bin package folder, I see a file with a ".class" extension.
Why does pressing Run|Run (Ctrl+F11) do nothingness? There is a brief hour glass showing, but then nothing after that.
How do I launch the application from within Eclipse?
Is the generated ".class" file the correct runtime? I double click on that and Windows does not know what to do with it?
The end platform will be CentOS, but Java as I understand things, should be platform independent, so my Hello World application should run on my Windows 7 Pro box just as nicely. (I did not try CentOS yet) as I want to see it work on my desktop and know what file to copy over.
I think you selected the wrong option EclipseStarter.
Try running it as a Standalone Java Application.
It is a Standalone Java Application that you're building, right?
(I mean, the analogue of a Windows Forms App in .NET)
1. I guess because you selected the wrong type.
2. Ctrl+F11 is for Running it, F11 only is for Debugging it.
3. The class file has to be run by a JVM, Windows cannot run it directly,
it is not anything like a native executable or like a .NET assembly
(which Windows 7 knows how to run). But as you're using Eclipse you
already have a JVM.
The solution is multi-fold.
I had to delete Eclipse and install the 32-bit version of everything. That simplified life, as 64-bit caused issues running.
Create a new package
From the toolbar, select "Create new visual classes" drop down. Select "SWT" --> "Application windows".
Create the application window
Press the play button, 8th icon having selected the package first.
That enabled to run my Hello World on Windows. The output is a .java.
I still have a problem running from the command line, but that is a different issue.
Summary: My main issue was creating a SWT application window first and that I should have 32-bit for everything.

Categories