I made a small java program with eclipse and here I have a trouble. If I try to open it with double click or right click (I tried on Windows and linux) does nothing. But I used "java -jar ...
" and it worked. How can I do that my program runs just by clicking on it?
Here is my code :
Utiles---->
package main;
public class Utiles {
private boolean n = false;
public Utiles() {
this.n = false;
}
public void limpia() {
for (int i = 0; i < 100; i++)
System.out.println();
}
public void salta() {
for (int i = 0; i < 5; i++)
System.out.println();
}
public void espacio() {
for (int i = 0; i < 2; i++)
System.out.println();
}
public static int countLines(String str) {
if (str == null || str.length() == 0)
return 0;
int lines = 1;
int len = str.length();
for (int pos = 0; pos < len; pos++) {
char c = str.charAt(pos);
if (c == '\r') {
lines++;
if (pos + 1 < len && str.charAt(pos + 1) == '\n')
pos++;
} else if (c == '\n') {
lines++;
}
}
return lines;
}
}