Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse Constantly "Searching for Main Types" when trying to run Java applications!
Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834697] Mon, 16 November 2020 10:48 Go to next message
Sam Holmes is currently offline Sam HolmesFriend
Messages: 6
Registered: November 2020
Junior Member
Hi everyone,

I'm having a strange problem with Eclipse. I say that it's strange because it only happens on my work laptop, not on any of the work desktops. For context, I'm teaching Java as part of a college course, but at the moment we're doing online only delivery for obvious reasons. If I was doing on-campus delivery I'd have no problems with running Java applications on Eclipse on any of the computers on campus, but when I try to use my work laptop (which HAS been issued by the college and is on their domain) I get this problem, EVERY TIME.

The problem is that when I try to run a program I get a message that says "Searching for main types..." and Eclipse starts indexing the files in the JRE folder (in Program Files). It ALWAYS takes AGES to do this, and it does it EVERY TIME I run a new Java application (i.e. a new project I've just created, or one I have imported).

(You can see the error message in the attached image file).

index.php/fa/39314/0/

Is there anything I can do to stop this happening? I've tried clearing out the Eclipse workspace and recreating it. I've tried opening a Java application first thing of the day and running it just so that the indexing will complete - but this doesn't work because as soon as I create a new project or import one I get the same problem.

I'm getting desperate because it usually happens during classes - which slows things down and confuses the students! Any suggestions would be welcome, especially as I've asked on other forums and haven't had any help.
  • Attachment: Eclipse.png
    (Size: 122.58KB, Downloaded 1757 times)
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834703 is a reply to message #1834697] Mon, 16 November 2020 15:08 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
How much RAM do you have on your laptop? What Xmx value have you set in the eclipse.ini file?
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834704 is a reply to message #1834703] Mon, 16 November 2020 15:13 Go to previous messageGo to next message
Sam Holmes is currently offline Sam HolmesFriend
Messages: 6
Registered: November 2020
Junior Member
David M. Karr wrote on Mon, 16 November 2020 15:08
How much RAM do you have on your laptop? What Xmx value have you set in the eclipse.ini file?


Hi there,

I have 8GB of RAM but seemingly in the eclipse.ini file the XMX value is 2048.

Could that be the issue?
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834719 is a reply to message #1834704] Mon, 16 November 2020 19:09 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
2gb for Xmx is good, but 8gb is somewhat small for Windows (10, I assume). I would ask what the corresponding numbers are for the desktops you use, but I imagine you're unable to get there right now.
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834813 is a reply to message #1834719] Wed, 18 November 2020 11:48 Go to previous messageGo to next message
Sam Holmes is currently offline Sam HolmesFriend
Messages: 6
Registered: November 2020
Junior Member
David M. Karr wrote on Mon, 16 November 2020 19:09
2gb for Xmx is good, but 8gb is somewhat small for Windows (10, I assume). I would ask what the corresponding numbers are for the desktops you use, but I imagine you're unable to get there right now.


I checked the college computers yesterday. They have 16GB RAM and Xmx of 2048. Do you think the 16GB of RAM could be the difference?
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834815 is a reply to message #1834813] Wed, 18 November 2020 13:43 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 139
Registered: October 2018
Senior Member
Hi there,

I have :

- 8.00 GB (7.88 GB usable)
- Windows 10 Home (20H2)
- eclipse.ini Xms256m Xmx2048m

With no problems.

I suggest a fresh install using :
https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_windows-x64_bin.zip
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2020-09/R/eclipse-java-2020-09-R-win32-x86_64.zip

And a fresh work space...
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834818 is a reply to message #1834815] Wed, 18 November 2020 14:37 Go to previous messageGo to next message
Sam Holmes is currently offline Sam HolmesFriend
Messages: 6
Registered: November 2020
Junior Member
Eitan Rosenberg wrote on Wed, 18 November 2020 13:43
Hi there,

I have :

- 8.00 GB (7.88 GB usable)
- Windows 10 Home (20H2)
- eclipse.ini Xms256m Xmx2048m

With no problems.

I suggest a fresh install using :
https://download.java.net/java/GA/jdk15.0.1/51f4f36ad4ef43e39d0dfdbaf6549e32/9/GPL/openjdk-15.0.1_windows-x64_bin.zip
https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2020-09/R/eclipse-java-2020-09-R-win32-x86_64.zip

And a fresh work space...


OK, I'll have to ask IT if they're able to do the install for me.
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834824 is a reply to message #1834818] Wed, 18 November 2020 16:00 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

At least for the Eclipse download, that's not an installer, that's a package you'd unzip and just run.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834834 is a reply to message #1834824] Wed, 18 November 2020 18:29 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 139
Registered: October 2018
Senior Member
The links I put in my previous message are plain zip files.

So installing is just unzipping to your chosen directories.

In my case to install :

I created G:\MyEclipse and C:\Java.

eclipse-java-2020-09-R-win32-x86_64.zip unzipped into G:\MyEclipse, So I have eclipse in G:\MyEclipse\eclipse.

openjdk-15.0.1_windows-x64_bin.zip unzipped into C:\Java , the result is C:\Java\jdk-15.0.1 (For simplicity I rename jdk-15.0.1 to jdk)

I set environment variables :

Set "JAVA_HOME" to C:\Java\jdk

Add to "Path" C:\Java\jdk\bin
index.php/fa/39336/0/

Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834838 is a reply to message #1834834] Wed, 18 November 2020 19:48 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
JAVA_HOME and the PATH entry have to point to the actual JDK distribution. From your example, "C:\Java\jdk" doesn't even exist, much less point to a specific JDK distribution.
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834841 is a reply to message #1834834] Wed, 18 November 2020 20:13 Go to previous messageGo to next message
Sam Holmes is currently offline Sam HolmesFriend
Messages: 6
Registered: November 2020
Junior Member
Eitan Rosenberg wrote on Wed, 18 November 2020 18:29
The links I put in my previous message are plain zip files.

So installing is just unzipping to your chosen directories.

In my case to install :

I created G:\MyEclipse and C:\Java.

eclipse-java-2020-09-R-win32-x86_64.zip unzipped into G:\MyEclipse, So I have eclipse in G:\MyEclipse\eclipse.

openjdk-15.0.1_windows-x64_bin.zip unzipped into C:\Java , the result is C:\Java\jdk-15.0.1 (For simplicity I rename jdk-15.0.1 to jdk)

I set environment variables :

Set "JAVA_HOME" to C:\Java\jdk

Add to "Path" C:\Java\jdk\bin
index.php/fa/39336/0/



OK, so I did that, and I got an error (see attached) when launching eclipse.

If I open the version of eclipse installed by the college, it opens normally but seems to still be using the installed version of the JVM. If I try to add the version I installed in settings it doesn't work (it says it's missing).

Back to the drawing board I think!
  • Attachment: error.png
    (Size: 8.47KB, Downloaded 95 times)
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834846 is a reply to message #1834841] Wed, 18 November 2020 21:04 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
That's because, as I said, your JAVA_HOME and PATH (more important than JAVA_HOME) are not set correctly. It's not finding your Java 15 distribution because it's not in the PATH. It has to point to the bin directory in your Java 15 distribution.
Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834853 is a reply to message #1834846] Thu, 19 November 2020 07:46 Go to previous messageGo to next message
Sam Holmes is currently offline Sam HolmesFriend
Messages: 6
Registered: November 2020
Junior Member
David M. Karr wrote on Wed, 18 November 2020 21:04
That's because, as I said, your JAVA_HOME and PATH (more important than JAVA_HOME) are not set correctly. It's not finding your Java 15 distribution because it's not in the PATH. It has to point to the bin directory in your Java 15 distribution.


It IS pointing to the bin directory. I checked the path entry for the JDK that is already installed and it says "C:\ Program Files\Java\jdk<version>\bin". So when I set my path I used "C:\Java\jdk<version number>\bin". Obviously c:\Java\jdk<version number> is where I unzipped the files to.

Like I say, even if I try to add the new JDK manually in Eclipse it has a red X against it and says it's missing.

Not really sure what to do next.

Re: Eclipse Constantly "Searching for Main Types" when trying to run Java applications! [message #1834881 is a reply to message #1834853] Thu, 19 November 2020 16:48 Go to previous message
David M. Karr is currently offline David M. KarrFriend
Messages: 800
Registered: July 2009
Senior Member
So do you have two JDK installations in your PATH at the same time? Is the Java 8 one earlier in the PATH than the other one? That would produce these results.
Previous Topic:An internal error occurred during: "Loading referenced grammars". org/eclipse/jdt/core/IEl
Next Topic:How to debug gradle appliction in eclipse?
Goto Forum:
  


Current Time: Thu Mar 28 15:41:12 GMT 2024

Powered by FUDForum. Page generated in 0.05152 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top