java - "Could not find the main class" -



java - "Could not find the main class" -

i'm trying run sample java application command promopt i'm getting next error:

exception in thread "main" java.lang.noclassdeffounderror: com/badlogic/gdx/helloworld/helloworlddesktop caused by: java.lang.classnotfoundexception: com.badlogic.gdx.helloworld.helloworlddesktop @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ java.lang.classloader.loadclass(classloader.java:306) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:301) @ java.lang.classloader.loadclass(classloader.java:247) not find main class: com.badlogic.gdx.helloworld.helloworlddesktop. programme exit.

the command i'm using seek , run app is:

java -cp .;gdx.jar;gdx-backend-jogl.jar com.badlogic.gdx.helloworld.helloworlddesktop

where relevant files in current working directory (.java, .class , .jar files)

the command used build .class files follows (there 2 .java files):

javac -cp gdx.jar;gdx-backend-jogl.jar helloworld.java helloworlddesktop.java

again run same working directory - contents of helloworlddesktop.java (more or less):

package com.badlogic.gdx.helloworld; public class helloworlddesktop { public static void main (string[] argv) { // application } }

i'm attempting larn java c# developer, wheras have strong background in programming concepts whole java toolchain confusing me. exception indicates class helloworlddesktop couldn't found, far can tell i've got right name , i've added right .jar files class path , java should able load class.

why can't find helloworlddesktop?

right - problem you've got helloworlddesktop.class in current directory, whereas should in com/badlogic/gdx/helloworld

you can prepare javac command - utilize -d . tell treat "." bundle root directory output.

normally want also organize source code package, "hello world" test may not worth it.

java classpath classnotfoundexception

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -