Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't run classes in packages

 
Post new topic   Reply to topic    Community Forum Index -> Java
View previous topic :: View next topic  
Author Message
Fenring



Joined: 23 Feb 2010
Posts: 1

PostPosted: Tue Feb 23, 2010 8:20 pm    Post subject: Can't run classes in packages Reply with quote

I recently switched to Windows 7, and now, after moving all my Java programs over, my classes in packages will no longer run. I can access them, but if my main method is in a class in a package, I get the following a NoClassDefFoundError.

Code:
package MyPackage;

public class MyClass{

   public static void main(String[] args){
      System.out.println("1");
   }

}


Code:
Exception in thread "main" java.lang.NoClassDefFoundError: MyClass (wrong name: MyPackage/MyClass)"


I've tracked the problem down to the fact that the parameters field for my "Run Java Application" tool is just $BaseName, so that it is effectively calling

Code:
java MyClass


when java is expecting

Code:
java MyPackage.MyClass


I've tried using the latter from the command line and it works.

Is there any way to get get TextPad to include the package, or to convince java that it doesn't need it?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB