| Author |
Java package
|
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
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.
|
 |
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
try running the test code from the base directory with the command java book.Goo
|
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
|
 |
Shiva Mohan
Ranch Hand
Joined: Jan 05, 2006
Posts: 465
|
|
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
Joined: Jan 17, 2006
Posts: 1295
|
|
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
Joined: Jan 05, 2006
Posts: 465
|
|
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
Joined: Jan 05, 2006
Posts: 465
|
|
|
Thanks.I figured that out.
|
 |
Arun Thakur
Greenhorn
Joined: Mar 15, 2006
Posts: 17
|
|
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
|
 |
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
|
|
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
|
Java API Documentation
The Java Tutorial
|
 |
 |
|
|
subject: Java package
|
|
|