package location
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hello,
say for example i have
package A
say for example i have
package A
amal shah
Ranch Hand
Posts: 92
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hello,
say for example i have
package A
class something
{}
package B
import A.*;
class anotherthing
{}
now in order to use classes of package A......where should we place the package A java file...i.e. in which folder....i believe it is supposed to be placed where jdk is installed.....but where....help appreciated
thanking you
amal shah
say for example i have
package A
class something
{}
package B
import A.*;
class anotherthing
{}
now in order to use classes of package A......where should we place the package A java file...i.e. in which folder....i believe it is supposed to be placed where jdk is installed.....but where....help appreciated
thanking you
amal shah
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
As a start make two folders, A and B and store them in the folder named "bin" in the folder that's named something like "jdk1.5.0" or comparable. Your .java files then go into these folder A xor B.
But you have to improve your code also a little, first a semikolon is missing in the package statements of your classes. Second "something" has to be coderanch, otherwise the import statement in the other class will produce a compiler error since class something will be visible in its own package only with no (=default) access modifier.
Yours,
Bu.
But you have to improve your code also a little, first a semikolon is missing in the package statements of your classes. Second "something" has to be coderanch, otherwise the import statement in the other class will produce a compiler error since class something will be visible in its own package only with no (=default) access modifier.
Yours,
Bu.
all events occur in real time
amal shah
Ranch Hand
Posts: 92
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
it dosen't work burkhard......am using jdk 1.4.1
how to go about it
help appreciated
thanking you
amal shah
how to go about it
help appreciated
thanking you
amal shah
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
See if this tutorial helps. I think it picks up right about where you are now. Let me know how it fits.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Burkhard Hassel
Ranch Hand
Posts: 1274
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
amal shah originally wrote
should work with 1.4.1 as with 1.5.0
perhaps try without packackes and a mini java programm if you can compile anything to figure out where the problem is.
Yours,
Bu.
it dosen't work burkhard......am using jdk 1.4.1
should work with 1.4.1 as with 1.5.0
perhaps try without packackes and a mini java programm if you can compile anything to figure out where the problem is.
Yours,
Bu.
all events occur in real time
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Please don't put your folders in "bin." That folder is for keeping .exe files from the jdk in.
Use this procedure for command prompt use; [if you use an IDE give the IDE a suitable path to a "java programs" folder, then let the IDE take care of all the packages.]
Create a folder called "programs" or something like that. Put all your .java files in it. In the example you have quoted, compile the files in "A" before the files in "B." As a general rule, any file without an "import" statement should be compiled first. Then compile the files which use those files in an import statement. Navigate to the location of the .java files. Use this sort of command line: c\JavaPrograms>javac -d . MyFile.java[enter] The -d means create directories, and the . means start from the current location. Run the file by prefixing the package name to the class name, eg c\JavaPrograms>java mypackage.MyClass[enter]
In the example Stan James quoted the link to, you might have to say
java com.mytoppackage.mysubpackage.MyClass[enter], because there are nested folders.
There are other ways to handle packages; read what the Java Tutorial says about them.
Use this procedure for command prompt use; [if you use an IDE give the IDE a suitable path to a "java programs" folder, then let the IDE take care of all the packages.]
In the example Stan James quoted the link to, you might have to say
java com.mytoppackage.mysubpackage.MyClass[enter], because there are nested folders.
There are other ways to handle packages; read what the Java Tutorial says about them.
amal shah
Ranch Hand
Posts: 92
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i am still unable to solve the problem...
this is what i have
both the below files are in c:\desktop\scwcd
//beerexpert.java //beer.java
package A; package B;
import java.util.*; import A.*;
public class beerexpert public class beer
{ {
} }
now i set the classpath as...
set classpath=.;%classpath%;c:\desktop\scwcd
so now it can search for package A....
then i compile as
javac beer.java
//compiler error
(1) package A does not exist
(2)cannot resolve symbol
symbol:class beerexpert
pls help...is there something that am unaware of
thanking you
amal shah
this is what i have
both the below files are in c:\desktop\scwcd
//beerexpert.java //beer.java
package A; package B;
import java.util.*; import A.*;
public class beerexpert public class beer
{ {
} }
now i set the classpath as...
set classpath=.;%classpath%;c:\desktop\scwcd
so now it can search for package A....
then i compile as
javac beer.java
//compiler error
(1) package A does not exist
(2)cannot resolve symbol
symbol:class beerexpert
pls help...is there something that am unaware of
thanking you
amal shah
amal shah
Ranch Hand
Posts: 92
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
the two files are as:
//beerexpert.java
package A;
import java.util.*;
public class beerexpert
{
}
//beer.java
package B;
import A.*;
public class beer
{
}
//beerexpert.java
package A;
import java.util.*;
public class beerexpert
{
}
//beer.java
package B;
import A.*;
public class beer
{
}
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
seems you don't bother to read tutorials?
because if you had read any introductory text you'd know what to do.
Most likely explanation: remember that Java is case sensitive.
because if you had read any introductory text you'd know what to do.
Most likely explanation: remember that Java is case sensitive.
42
amal shah
Ranch Hand
Posts: 92
posted 19 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
thanks to all....got the point 

| Evil is afoot. But this tiny ad is just an ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |










