• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

disturbing package issue

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is like I have some sort of brain dead thing going on. My excuse is that I am recovering from being sick as a dog.
If this is my source named "Kevin.java" ==>
package testPackage;
public class Kevin {
public static void main( String[] args ) {
System.out.println("Kevin is here");
}
}
It is located here ==>
c:\test
I set the classpath like this ==>
c:\test set classpath=c:\test
I compile it like this ==>
c:\test javac -d c:\test Kevin.java
and of course it creates the subdirectory named "testpackage".
QUESTION:
Why can't I get it to run? I have tried everything I can think of. I can not get it to execute.
thanks to anybody who helps the brain dead today.
Kevin
 
whippersnapper
Posts: 1843
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
c:\test>java testPackage.Kevin
or
c:\test>java testPackage/Kevin
[ March 06, 2003: Message edited by: Michael Matola ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the class file in the testPackage directory? When trying to run the app, using exactly what command produces exactly what result?
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I did to get your program to work:
1. I changed the package name to testpackage.
2. I created c:\test
3. I compiled with javac -d c:\test Kevin.java -> c:\test\testpackage\Kevin.class
4. I ran it with java -cp c:\test testpackage.Kevin
I prefer to use lowecase letters for packages to ensure that Windows creates lowercase directories.
My working directory was c:\temp, that is where Kevin.java is.
Hope that helps
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey look at that, you got three bartenders with one shot!
 
Kevin Thompson
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks! it works fine!
Dirk: I was getting a
java.lang.NoClassDefFoundError
thanks!
Kevin
[ March 07, 2003: Message edited by: Dirk Schreckmann ]
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic