Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to run program in console in a package

 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been using a small editor to compile my cattle drive programs.
Now I am trying out JBuilder8 to get experience with it. It puts everything in a package - how do you call a package from the console.
I get the following error message.
----------------
C:\JBuilder8\samples\test\classes\test>Java Say 4
Exception in thread "main" java.lang.NoClassDefFoundError: Say (wrong name: test
/Say)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
----------------------
the java class I am running from the console is
Say
the file structure is (Say.class sits in test folder) - the 2rd one
C:\JBuilder8\samples\test\classes\test
- the package is = package test;
Thanks
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it, I looked in other messages and found the answer there
=
C:\JBuilder8\samples\test\classes\test>cd..
C:\JBuilder8\samples\test\classes>java test.Say 4
four
C:\JBuilder8\samples\test\classes>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic