Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

BrainlessDesigns

[java] probs w/ my first java app

This topic is 5367 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi there! today i converted my c++ game ai main routines to java. i installed the latest j2se sdk from sun and could compile it w/ javac. when i started java i got the following error: Exception in thread "main" java.lang.NoClassDefFoundError: myApp i''ve win2000 and the latest sun sdk where''s the problem? i experimented w/ the classpath but nothing worked. can anybody help me please... here''s a part of my code: /*********************************************************************************** * lettermix class - implements all game functionality * ***********************************************************************************/ package LetterMix; import LetterMix.Dict; import LetterMix.Cubes; import LetterMix.Board; import LetterMix.Word; import java.io.*; public final class LetterMix { private static final int COUNT_OF_CUBES = 13; private static final int BOARD_WIDTH = 13; private static final int BOARD_HEIGHT = 13; private static final int NOT_USED = 0; private static final int LEFT_TO_RIGHT = 1; private static final int UP_TO_DOWN = 2; private static final int EASY = 0; private static final int NORMAL = 1; private static final int HARD = 2; private static final int AI_MODE_ONE = 0; private static final int AI_MODE_TWO = 1; private static final int AI_MODE_THREE = 2; private static final int COUNT_OF_AI_MODES = 3; private static Dict dict; private static Cubes cubes; private static Board board; private static Word words[]; private static int difficulty, wordCount; private static String bestWord; public static void main(String argv[]) { if(init(argv)) { startThinking(); showResults(); } else { System.out.println("init failed..."); } } public static boolean init(String argv[]) { dict = new Dict(); cubes = new Cubes(); board = new Board(); words = new Word[COUNT_OF_CUBES]; //no parameters... if(argv.length==0) { System.out.println("LETTERMIX ai_mode [cubes_init_string]"); return false; } //select difficulty if(argv.length>0) { switch(argv[0].charAt(0)) { case ''E'': difficulty=EASY; break; case ''N'': difficulty=NORMAL; break; case ''H'': difficulty=HARD; break; default : System.out.println("unsupported difficulty..."); return false; } } //have we a second parameter? if(argv.length>1) { //this cube init string sux... if(argv[1].length()!=COUNT_OF_CUBES) { System.out.println("cube init string wrong..."); return false; } //initialize cubes w/ init string cubes.init(argv[1]); } //ok, then we... else { //...let the random play cubes.init(""); while(!cubes.roll()); } //initialize dictionary try { dict.init(); } catch(IOException e) { System.out.println("dictionary init failed..."); return false; } board.init(); wordCount=0; return true; }

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Maybe its because you''re using a package...

What is myApp? The class must be declared in a .java file of the same name, and compiled to a class file of the same name.

Share this post


Link to post
Share on other sites
Hi
If you say something like: public class yourName the java file has to be the same as that name. Example:
public class Test
is in the file Test.java and when compiled it's called Test.class. So you use java test to start it

Hope this can help you
Wesley

[edited by - wicked_wesley on February 7, 2004 5:17:47 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Anonymous Poster
Maybe its because you''re using a package...

What is myApp? The class must be declared in a .java file of the same name, and compiled to a class file of the same name.


yeah you need to do java LetterMix.LetterMix to run the program i think

Share this post


Link to post
Share on other sites
thanx 4 all!

i''ve found the problem. it was not the classpath but the wrong import path - i dropped the package statement and put the main class to the parent folder and the rest in the actual. sometimes it''s so easy...
i thought that there must be something wrong with win2000 and the new j2se sdk. i tried everything with the classpath but nothing happened. damn. it costed me 3 hours to run it.
but now it''s fine :-)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!