Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Package Question

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Layout


Code




Action


Q
Want to compile and run yeaimmad.java...wat do?
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"-cp C:\ocjp2" is not correct, it should be "-cp C:\", since "ocjp2" is part of the package hierarchy, and the classpath should contain the root of the package hierarchy.

Also, move up a level into the c:\ directory and run the command from there - then the compiler will find other (possibly uncompiled) classes.
 
Harry Preston
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks much
I try



Wat do?
 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If class "yeaimmad" is in package "mad" -as opposed to package "ocjp2.mad", then it should be in C:\mad, not C:\ocjp2\mad (which is how I understood your directory layout to be). The directory hierarchy needs to be the same as the package hierarchy.
 
Harry Preston
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! You helped me solve
But actually my desired directory hierarchy is unchanged
How I fixed issue is change yeaimmad.java package name

package ocjp2.mad;
instead of
package mad;
 
Dinner will be steamed monkey heads with a side of tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic