Andrew Stallard

Ranch Hand
+ Follow
since Mar 06, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andrew Stallard

I am interested in doing some programming using Java EE. Now, I need to know what, if anything, I will need to download.

Upon typing java -version on the command line I get:

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

Now, does this output indicate I have the necessary API's, or do I need to download and install something. If so, what, and, what (classpath) problems might arise when doing this?
11 years ago

Jesse Shapiro wrote:Hi!

I'd really like to embark on a career in programming and thought getting an SCJA might be a great step forward. I'm a little worried though because I've only taken a few programming classes. A programming theory class (all pseudo code and algorithms), Java 1 (Selections, Operators, Loops, Methods, Arrays, Object Oriented, Classes, Strings and Text I/O, Inheritance and Polymorphism), and Web Scripting Languages, and did really well in all of them. Do you think that comprehending, memorizing, and practicing the content from an SCJA study guide alone would be enough for me to pass the exam? Or do I just not have a wide enough Java base at this point to jump into exam prep and maybe need to take a Java level 2 course first?

Thanks for the direction!

-unsatisfied sys admin

I am trying to study for this exam as well. It seems like the objectives are a mile wide and an inch deep. According to the McGraw-Hill study guide which I am using, you need to be familiar with the web-based and mobile api's but not actually do any programming with them. It seems like the test is about memorizing the meanings of a bunch of abbreviations and describing briefly what they do. (Is that correct?)
11 years ago

Bear Bibeault wrote:

OK, I've got it. You need parenthesis around the boolean equality.

11 years ago
Now, I am trying to compare the boolean equality to the .equals method. Here is the relevant code:

Now, here is the output upon running:

line 03 output

snake.equals(frog) ? true
line 04 output

line 06 output

line 07 output

dog.equals(frog) ? true
line 08 output

dog.equals(snake) ? true
line 09 output

line 13 output

line 14 output

line 15 output

Now, my confusion comes from the output of lines 06 and 15. Is it not true that if you use the equal sign to assign one variable as equal to another they will have the same reference, and will hence be "boolean equal?"

In addition, why is it that when I print out a boolean equality the string preceding it is not printed?

Thank You for Responding:

Andrew Stallard

11 years ago
I have RedHat Linux, and I want to set the classpath for my junit utility. According to your faq I should have a file called .bash_profile in my home directory. However, I can't find it anywhere. In addition, I tried creating this file in my home directory and running it as a shell script. I tried:

This does nothing. How can I do this?

Thank You for Responding

Andrew Stallard
11 years ago

Jeanne Boyarsky wrote:I'm not sure. Your classpath looks right now.

Is "moneyx" in your code/directory anywhere? It almost looks like the code was compiled as if it were in the moneyx package and now is being run without that.

It works if I remove the package declarations.

Works from working directory without package declarations:

In addition, I've tried going to the parent directory and compiling and running from there. That didn't work whether I had the package declarations on MoneyTestCase or not.

Does not work at all. (from parent directory):

11 years ago

Jeanne Boyarsky wrote:Try:

The current directory isn't in the classpath in your example.

Also, note that the swingui runner has been removed in JUnit 4.X. At that point, you'll have to use the IDE runner if you want a green bar.

Now, I have a different error:

Exception in thread "main" java.lang.NoClassDefFoundError: MoneyTestCase (wrong name: moneyx/MoneyTestCase)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(
at java.lang.ClassLoader.defineClass(
at java.lang.ClassLoader.defineClass(
at junit.runner.TestCaseClassLoader.loadClass(
at junit.runner.ReloadingTestSuiteLoader.load(
at junit.runner.BaseTestRunner.loadSuiteClass(
at junit.runner.BaseTestRunner.getTest(
at junit.swingui.TestRunner.runSuite(
at junit.swingui.TestRunner.start(
at junit.swingui.TestRunner.main(

Again, I'm not sure why this happens. The class is right there and the classpath is specified in the java command.
11 years ago
The problem only occurs from the command line. In the IDE it works fine.
11 years ago

Tim Holloway wrote:Normally Ant comes self-contained, although you can add extensions. However, Red Hat turned darned near every jarkarta project and quite a few other things into separate RPMS. Which is a bit over-granular for me, but such is life. Yum would have resolved any dependencies.

Check to make sure that you're really running the Sun JVM and not gcj. Use the "java -version" command.

Yes, I am using the real thing. I installed myself.

java -version // yields

java version "1.6.0_19"
Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
Java HotSpot(TM) Client VM (build 16.2-b04, mixed mode, sharing)
11 years ago

Tim Holloway wrote:No, I've never seen that happen. What platform are you building on, and if it's Linux, are you using the gcj Java or a "real" java?

I use java version 1.6.0_19 from Sun Microsystems. Yes, I use Linux (Red Hat)

It's also possible that the jars didn't install. For example, if you unzipped the Ant download and the disk filled up while in the middle of the extraction process.

I installed Ant using yum. There were no reported errors. Is there a list of jars somewhere at Ant's website? I couldn't find anything like that over there.
11 years ago
I have successfully compiled the junit test case class MoneyTestCase

Now, when I try to run it using this command:

java -classpath /usr/share/java/junit.jar junit.swingui.TestRunner MoneyTestCase

I get an error stating:

Class not found "MoneyTestCase"

Nevertheless, MoneyTestCase.class is right there in my working directory.

Now, when I click the drop-down box on the swingui I get this message:

No Test Cases Found.
Check to see the configured 'Test Collector' is supported on this platform.

Has anybody else dealt with this problem?

Thank You for Responding.

11 years ago
Every time I build with Ant I get the following error whether the build is successful or not:

/usr/bin/build-classpath: error: Could not find xml-commons-apis Java extension for this JVM
/usr/bin/build-classpath: error: Some specified jars were not found

Does this happen to anybody else and what problems might it lead to?

Thank You for Responding.
11 years ago
Here it is. Except for the first line, it is the same code as in the link I provided.

11 years ago

Aaron Liu wrote:Edit your xml file using a text editor. At the very beginning of the first line, look for and delete any leading spaces.

The following first line of the xml must not have any spaces or characters before the first "><" in the line.

<?xml version="1.0" encoding="UTF-8"?>

Try the import again.

I hope it's useful to you.

No, that's not the problem.

Thanks anyway!
11 years ago
OOPS! I posted this to the wrong forum--sorry!
11 years ago