Pregunta

Estoy intentando conseguir un programa de ejemplo se trabaja con JUNG , una herramienta de graficar en Java. He descargado y se hace referencia a todos los archivos .jar en Eclipse así que mi proyecto de jerarquía es similar al siguiente: alt texto http://img638.imageshack.us/img638/6787/hierarchy.png

En Test.java tengo el siguiente código:

public class Test {

static public void main() {
    System.out.print("Hello");
}}

Por alguna razón, sin embargo cuando intento ejecutarlo como una aplicación Java haciendo clic derecho en la prueba de Jung en el proyecto jerarquía se me presenta un montón de clases. Mi Test.java no está en la lista por lo que si lo dejo como ** y pulse OK empieza a ejecutar un programa que agrega dinámicamente nodos y vértices de un gráfico. Me parece que no puede averiguar qué código es en realidad la ejecución. Sé java, pero este tipo de cosas con los archivos jar parece estar perdido en mí. Algunas ideas?

Gracias

¿Fue útil?

Solución

My guess based on the symptoms that you have posted is that your startup command in Eclipse is pointed to the wrong main class. First off, your main method needs to look like this:

public static void main(String[] args) {
    //stuff here
}

Then you can right-click on the file (either in the editor or in the explorer view) and choose "Run As -> Java Application" from the context menu. This will create a run configuration for that main file.

I think the real problem is that you don't have the main method defined correctly - that will allow your class to show up as a possible class to run from.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top