I am new to java programming, Ubuntu, and Eclipse (usually work on win7 ultraedit/monodevelop/visualstudios with C#, C++, MONO, PHP)
I have installed the java-sdk ( + tons of other java packages ) on my machine + Eclipse and cannot run a simple project through Eclipse.
I can build a .java file, by executing the java file in the terminal using javac to build the class file and java file.class to execute it. I want to use eclipse to build and run my projec开发者_高级运维t and it's not working.
In my eclipse run configurations I have it using the JRE java-6-sun-1.6.0.26 (which is installed) but it's still not working.
When I try and run a simple project
public class main {
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
while(true){ }
}
}
the only thing in the console is:
main(1)[Java Application] /usr/lib/jvm/java-6-sun-1.6.0.26/bin/java (Sep 20, 2011 12:22:12 PM)
That path and file does exist. I don't know what's going on.
You have an infinite loop in your main method. This will run for ever without doing anything.
Try
public static void main(String[] args)
{
// TODO Auto-generated method stub
while(true){
System.out.println(new java.util.Date());
}
}
and run again.
Double-check your default java settings:
update-alternatives --display java
IIRC, Eclipse in Ubuntu depends on OpenJDK.
You can set up your default jvm by running:
update-alternatives --config java
精彩评论