Riley Thomas

Greenhorn
+ Follow
since Aug 08, 2009
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 Riley Thomas

...which was merely more of a formality of sitting for the exam. I'm in the middle of SCJP preparation and since my employer reimburses the cost of a passed exam, I had little to lose. It's been quite some time since I took a test and wanted the practice

Onward to the SCJP
13 years ago
All,

The code snippet below is behaving as expected (hooray!) except that the display of the "County" dropdown is not where it's supposed to be. The submit action does capture the value, however. Any thoughts? Thanks!
13 years ago
Assuming there is no limit to the amount of balls that can be placed on the scale, the answer is 3 weighs.

1: Weigh 6 balls on each side. The heavier side (obviously) contains the irregular ball.
2: Of those 6, weight 3 on each side. Again, the heavier side has the irregular ball.
3: Of those 3, weigh any 2. If they're equal, the third ball is the irregular.
14 years ago
Hey all,

I'm scheduling my SCJA exam shortly and have a question related to exam scoring - for questions with multiple responses, how does Sun tabulate scoring? For example, if 3 responses are required, must all 3 be correct for credit? If 2 of the 3 are correct, is partial credit given?

Thanks!
14 years ago
I'd also recommend going through the Cattle Drive (located on this site) and there are lots of quick programming problems on JavaBat.com.
14 years ago
...and it worked for me too - thanks!

Time to start using ANT now
14 years ago
I double-checked the file and it does contain the com/javaranch/common directory.

Correct, I am using OS X with Java 1.5.

I've found that if I reverse the order of the jar files - typing:
$ javac -cp ~/tomcat/apache-tomcat-6.0.20/lib/jr.jar:~/tomcat/apache-tomcat-6.0.20/lib/servlet-api.jar -d classes src/***.java - it returns errors regarding the javax.servlet classes; so whatever comes second in that classpath list doesn't work.
14 years ago
The jr.jar file is definitely located in the /lib directory.

Here is what I'm trying to compile:



The error is: src/NowServlet.java:4: package com.javaranch.common does not exist
import com.javaranch.common.*;
^
1 error
14 years ago
Hello,

I'm trying to use the Str class from the jr.jar library when working with a servlet - but the second jar file listed in the command below doesn't seem to get picked up.

$ javac -cp ~/tomcat/apache-tomcat-6.0.20/lib/servlet-api.jar:~/tomcat/apache-tomcat-6.0.20/lib/jr.jar -d classes src/filename.java

Any thoughts? Thanks much.
14 years ago
Great - thanks for your help!
14 years ago
Sorry, still learning my way around here.
14 years ago
Hey all,

I can't seem to sort out this error using very basic packages - I think this may be resolved with a flag with javac, but first things first.

package hello;

public class HelloWorld{
public static void main(String[] args){
System.out.println("Hello World!");
}

}

Compiles fine, but :$ java HelloWorld produces:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong name: hello/HelloWorld)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

:$ java hello.HelloWorld produces:
Exception in thread "main" java.lang.NoClassDefFoundError: hello/HelloWorld

I know this is so basic and I've worked with packages previously, just not on my home machine (running 1.5 under OS X) before.

Thanks-
DJ
14 years ago