Trent DiBacco

Greenhorn
+ Follow
since May 24, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Trent DiBacco

I just started working on the SCJD myself (URLyBird 1.2.2). I am using "SCJD Exam with J2SE 5" by Terry Camerlengo and Andrew Monkhouse. The book is very informative yet easy to read. I just read the chapters 4 on threading and found it to one of the best tutorials on the topic.
Jim Y,
Thanks for the tip, i will amend the code above

[ January 25, 2004: Message edited by: Trent DiBacco ]
20 years ago
20 years ago
and as another add on, this works with anonymous arrays as well.

[ January 11, 2004: Message edited by: Trent DiBacco ]
20 years ago
Just as a performance note:
You create more object then necessary.

This is how you might correct it

Just my two cents worth.
[ January 11, 2004: Message edited by: Trent DiBacco ]
[ January 11, 2004: Message edited by: Trent DiBacco ]
20 years ago
You want to do is a WindowEvent to your JFrame and either
implment a WindowListener interface or use a helper class named WindowAdapter. The method that you will want to implement in either of these two types is the "void windowClosing(WindowEvent e)" method.
Here is my example. This will creat a small window with a button in the center, use either the button or the x to close the JFrame, and watch the output in your console.

[ January 03, 2003: Message edited by: Trent DiBacco ]
[ January 03, 2003: Message edited by: Trent DiBacco ]
[ January 03, 2003: Message edited by: Trent DiBacco ]
[ January 03, 2003: Message edited by: Trent DiBacco ]
21 years ago
This is one question I know for sure.
Step 1. Point your browser to http://java.sun.com/j2se/1.4/download.html
Step 2. Click on the "DOWNLOAD" link in the row that matches "Linux GNUZIP Tar shell script" and the column that mathches "SDK".
Step 3. Read the Licence!!!, Click on "ACCEPT"
Step 4. Click on the link "Download j2sdk-1_4_0_01-linux-i586.bin." and save to disk.
Step 5. Open open your command line termenal.
Navigate to the directory that you saved the file.
Step 6. Run the following command:
sh j2sdk-1_4_0_01-linux-i586.bin
Step 7 This will create a directory named "j2sdk1.4.0_01". You can change the name of this directory if you like, lets do that with the following command:
mv j2sdk1.4.0_01 java
Step 8. If you would like java to be avialable to all your users, login in as root, and move the java directory, I like to put it here:
mv java /usr/java
Other wise you can leave it in your home directory.
Step 9. Now the important part to remeber.
You must add the java directory's bin directory to your PATH enviromental variable.
If you want Java to be avialiable system wide to all your users, edit the /etc/profile file
and append :/usr/java/bin to your PATH varable.
If there is not a PATH variable make your own entry that looks like this.
export PATH="$PATH:/usr/java/bin"
Note! if you just want to make it available to your self you would edit your local profile, witch may be .profile, or .bach_profile in you home directory. if you do not have either of these files you may make them:
touch ~/.profile
Then edit that file with your favorite editor.
and add the following:
export PATH="$PATH:/<path to your java directory>/bin
Of cource apply the correct path to your java direcotry.
Then your set. you Have SDK, and the JRE installed and will beable to use either in the same way as your widows system.
I hope you enjoy, any trouble just email me
22 years ago
this is the way i would look at it
Use abstract if you plane on make a class more specialized
example you want to make a class GermanShepard,
since GermanShepard is a more specilaized verison of a dog, and there are no such things as just dogs, there are only diffrent type of dogs the dog would make an exelent canidate ore abstraction
class dog{
...
}
class GermanShepard expands dog{
...
}
and use interface when you think many unrelated obj may posses a similar method or characteristic.
like say eyes, ears, nose, walk() talk().
then you might make and Anaimal interface
I know what your thinking, why not make Anaimal a abstarct class as well. You could, but providing and interface allow for you to right other classes that call on the interface methods of classes that you have yet to even dream of making.
It also give you the ability to implement many characteristics with multible interfaces, there is no mulitple inhertance so this is a big advatage.
so this is my little example
interface Anaimal{
String talk();
}
abstract class Dog implement Anaimal{
abstract String wagTail();
}
class GermanShepard expands Dog{

String talk(){
return "Woof Woof";
}
String wagTail(){
return "Up Down, Up Down";
}
}
//Notice i am implementing to interfaces
class Human implements Anaimal, Primate
{
String talk(){
return "Hello";
}
}
Notice that both the Human and the GermanShepard use the talk() method, yet only the dog wags a tail.
This wount compile but i hope you get the point, if not e-mail me and i will make a working example for you.
example
[ June 07, 2002: Message edited by: Trent DiBacco ]
22 years ago
add your current directory other wise know in java as the Defualt package to your classpath
CLASSPATH = %CLASSPATH%;. <- this dot indicates current direcoty, the %CLASSPATH% is just my shorthand to what ever you had before.
so basicaly im saying add a dot(. or ./) to your class path.
[ June 07, 2002: Message edited by: Trent DiBacco ]
22 years ago
Just a beginner, but if I am not mistaken the -jar parameter just tells the JRE that there is a field in the manifest called Main-Class and to start execution of the class. So i belive it excutes just as if you un-jarred (is that a word) the file and excuted the main file with out the -jar argument.
But what do i know...
22 years ago
IDE
I have been doing all my programming with vim or some sort of text editor, and while this has suited my purpose just fine, I am curious to what IDE's people like, and what IDE is considered Java's industry standard (if any).
What I am looking for is a robust IDE to help me become more effecient, easy to use, easy to learn, integrate with Sun's SDK, and that I should know professional if i ever get a job as a java programmer. not neccessarly in that order.
What I am NOT looking for is a another text editor with lots of toys (while these are nice) i while stick with vim and JEdit for that sort of thing.
I am ready to give up my hard earn dough too, so dont limit your suggestions to free, and share ware.
The two that I am most curious about is Borlands J Builder, and Sun's Forte.
Thank you ranchers, I look forward to your comments.
P.S. please include version numbers, and if there is a newer version in the workes, if your recommendation is for an IDE that i would have to purchase, i.e. whats upcoming for J Builder.
Thanks again!
22 years ago
If i am not mistaken your classpath is missing somthing.
Your missing the java home directory.
try this (this might be a tad off since i am a linux user but i think this should work for you)
open your console, (start, run, command)
set javahome=C:\j2sdk1.4.0 (or where ever you put it)
set classpath=%javahome%;%javahome%\lib;. (period included at the end)
set path=%PATH%;%javahome%/bin
then try and exicute your code!
if this work make the settings final by editing your autoexec for win9x family, or right click on your "My Computer" and i belive its manage if i recall, then last tab, and look for env varables
somthing like that...
when you install SDK for win it also installes a seperate JRE under your Program Files, this is why the command java ran and not javac!!!
Go open source bro, and move to Linux :^)
22 years ago
how do i make my own jar executable so that a user can just type:
java -jar myJarFile.jar
[ May 29, 2002: Message edited by: Trent DiBacco ]
[ May 29, 2002: Message edited by: Trent DiBacco ]
22 years ago
Im just a greenhorn, but they I have successfully installed j2sdk 1.3/1.4 on many diffrent distros of linux.
I download the Linux GNUZIP Tar shell script, (just becase i dont liked rpms) and then executed the script with:
sh j2sdk-1_4_0-linux-i386.bin
or
./j2sdk-1_4_0-linux-i386.bin
this will create a directory in your current directory named j2sdk1.4.0 or to that effect.
then you may move this directory to where ever you like.
( I like to place it here: /usr/java/j2sdk1.4.0)
then i modify my PATH to include the bin subdirectory of j2sdk directory.
thats it!
22 years ago
Thank you very much Ilja Preuss. The link provided above was very informative. Thanks to all the other "Rancher Hands" too.
I really love this site. It is one of the few special places on the net.
[ May 25, 2002: Message edited by: Trent Green ]
22 years ago