• 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

Java package

 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am writing all program in netbeans(same project name,but creating multiple files).When I started to work on package I have created two files (Java_StudyNotes, Goo).

Program codings are given below.





I have created two directries namely cert and book at command line.But,I thought,I have to add Java_StudyNotes file in cert directry as well as Goo file in book directory by using edit command through command line.

But it is showing the Error

Edit is not recognized as an external or internal command,operable program or batch file.

I couldn�t figure out what�s wrong.Please help me.
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try running the test code from the base directory with the command

java book.Goo
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Garrett,

Thanks for the reply.I tried.but this time the error is

C:\java\Basic\Examples\SCJP\src\cert\book>cd..

C:\java\Basic\Examples\SCJP\src\cert>cd..

C:\java\Basic\Examples\SCJP\src>java book.Goo
Exception in thread "main" java.lang.NoClassDefFoundError: book/Goo

Please help me again to work this package.
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you compile the classes compile them from the base directory as

javac cert\Java_StudyNotes.java

javac book\Goo.java

And then run the test code as:

java book.Goo
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Before,i created the Java_StudyNotes class file.But i didn't create Goo class file yet.It is showing some error.

C:\java\Basic\Examples\SCJP\src>cd cert

C:\java\Basic\Examples\SCJP\src\cert>javac Java_StudyNotes

C:\java\Basic\Examples\SCJP\src\cert>cd book

C:\java\Basic\Examples\SCJP\src\cert\book>javac Goo
Goo.java:2: package cert does not exist
import cert.Java_StudyNotes;
^
Goo.java:5: cannot resolve symbol
symbol : class Java_StudyNotes
location: class book.Goo
Java_StudyNotes o=new Java_StudyNotes();
^
Goo.java:5: cannot resolve symbol
symbol : class Java_StudyNotes
location: class book.Goo
Java_StudyNotes o=new Java_StudyNotes();
^
3 errors
please help me to rectify those errors.
 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.I figured that out.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey shiva,

can you plz explain clearly how was your class and file hierarchy. and how u finally u complied your program.
I have a similar problem and still I am not able to figure out.

Thanks
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shiva Mohan:
I am writing all program in netbeans(same project name,but creating multiple files).When I started to work on package I have created two files (Java_StudyNotes, Goo).
...
I have created two directries namely cert and book at command line.But,I thought,I have to add Java_StudyNotes file in cert directry as well as Goo file in book directory by using edit command through command line.

But it is showing the Error

Edit is not recognized as an external or internal command,operable program or batch file.

I couldn�t figure out what�s wrong.Please help me.



I think part of the problem is that you said you are using NetBeans then you say you are using the command-line to do a few tasks. While this is okay, you need to understand how NetBeans creates the directory hierarchy for a new project.

Also, another problem is that there does not seem to be an "edit" command available on the command line. What I suggest is that you use a text editor (like Notepad) or the editor in NetBeans to create a new file and save it in the directory where it should go.

I hope this helps.

Layne
 
no wonder he is so sad, he hasn't seen 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