Andrew Stallard

Ranch Hand
+ Follow
since Mar 06, 2010
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 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?
13 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?)
13 years ago

Bear Bibeault wrote:http://www.difranco.net/cop2551/java_op-prec.htm



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

13 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:

false
line 03 output

snake.equals(frog) ? true
line 04 output

false
line 06 output

false
line 07 output

dog.equals(frog) ? true
line 08 output

dog.equals(snake) ? true
line 09 output

false
line 13 output

false
line 14 output

false
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


13 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
13 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):




13 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(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
at junit.runner.TestCaseClassLoader.loadClass(TestCaseClassLoader.java:112)
at junit.runner.ReloadingTestSuiteLoader.load(ReloadingTestSuiteLoader.java:9)
at junit.runner.BaseTestRunner.loadSuiteClass(BaseTestRunner.java:208)
at junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:101)
at junit.swingui.TestRunner.runSuite(TestRunner.java:666)
at junit.swingui.TestRunner.start(TestRunner.java:783)
at junit.swingui.TestRunner.main(TestRunner.java:104)

Again, I'm not sure why this happens. The class is right there and the classpath is specified in the java command.
13 years ago
The problem only occurs from the command line. In the IDE it works fine.
13 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)
13 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.
13 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.




13 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.
13 years ago
Here it is. Except for the first line, it is the same code as in the link I provided.

13 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!
13 years ago
OOPS! I posted this to the wrong forum--sorry!
13 years ago