wood burning stoves*
The moose likes Beginning Java and the fly likes PACKAGES Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "PACKAGES" Watch "PACKAGES" New topic
Author

PACKAGES

Harjeet Dadwal
Greenhorn

Joined: Sep 09, 2001
Posts: 17
I'm doing following code but it doesn't work, why ?
I'M EXPLAINGING HEREUNDER:-
I created a directory in jdk1.3\bin named as p1
and then created a file named as Class1.java in p1
eg.

then I compiled it as:-
f:\jdk1.3\bin\p1>javac Class1.java
Then I created a directory p2 in jdk1.3\bin\p1.
and created a java source file named as Class2.java
eg.

and then compiled it as:-
f:\jdk1.3\bin\p1\p2>javac Class2.java
And then created a file at root directory of p1 named as Importer.java
eg.

then I compiled it as:-
f:\jdk1.3\bin>javac Importer.java
BUT IT GIVES ERROR AT COMPILE TIME AS:- Class1 is a bad file name
no class file in p1.Class1 specify the correct path
But if change the code of as in Importer.java as import p1.Class1
and import p1.p2.Class2
then it comiples successfully and run fine.
PLEASE TELL WHY IT DOESN'T RUN USING "*" ???
------------------
Harjeet Singh Dadwal

(added code tags)
[This message has been edited by Marilyn deQueiroz (edited September 16, 2001).]


Harjeet Dadhwal
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Your java files are just fine!
But when you compile it use.

and you should do fine!
// MAthias
Harjeet Dadwal
Greenhorn

Joined: Sep 09, 2001
Posts: 17
whoops......!!!
sorry Mathias It was not working yesterday but today runs without modification, I couldn't understand what happened but thanks anyway, very thanks to you for your reply.
bye
------------------
Harjeet Singh Dadwal
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: PACKAGES
 
Similar Threads
error while compiling
Package & Compilation Problem
naming : package, inner classes
Reg. Packages
Marcus Green - Exam 2 - Question 9