I've recently gotten a new 64-bit Windows Laptop that I need to set up. While trying to set up Java and a working IDE, I ran into the following issue:
I have a very simple test program that I try to run in Eclipse Oxygen 3.0 (also tried in IntelliJ, but the same problem occurred):
public class MinSuche {
public static void main(String[] args) {
int[] feld = {12, 18, 19, 22, 1, 37, 5};
int min = feld[0];
int a = 1;
while(a<feld.length){
if(feld[a]<min){
System.out.println(min);
min = feld[a];
a++;
}
}
System.out.println(min);
}
}
The Compliler Compliance Level is set to 1.8 and I am using jdk1.8.0_161 (also tried Java 9, same issue; and my Eclipse apparently can't handle Java 10 yet). Now the problem:
It does not terminate on its own and the results of the System.out.println-commands do not show up in the console. I get no errors and have failed to find any other hints as to what could be wrong, but I get the feeling that this doesn't have anything to do with the code. The process just keeps running and running for minutes (maybe even hours if I let it) until I terminate it manually, nothing shows up on the console the entire time of running.
Has this happened to anyone before? What could be the problem? Or am I missing something in the code? Please help, I need a working Java IDE on my PC!
a++outside of theif. You never stop loopingforinstead ofwhile, it's more idiomatic.