Joe Lemmer

Ranch Hand
+ Follow
since Oct 24, 2008
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joe Lemmer

Yep. As has been suggested the SCJP Sierra / Bates study guide is fine for this exam and that's all I used apert from the Wizzlabs exam, which I found much harder than the real exam (which it is according to the general concensus on the interweb).

Plus writing a lot of code.

Cheers
Hiya,

Since Oracle took over Sun, they have rebranded all the exams. So, what used to be SCJP is now called OCPJP (Oracle Certified Professional Java Programmer). It is exactly the same exam.

This link shows you the path for core Java (Java SE) which can start at the Oracle Certified Associate exam, which is obviously the easiest, but the OCA is not a prerequisit to take the OCPJP.

Hope that helps
I see. Thanks for that. I didn't realise that I had to do that even when I had set the classpath via the environment variable, rather than at the command line.

I have included:



in the classpath environment variable so it now always looks in the current directory.

Many thanks

Joe
12 years ago
Cool. Thanks Joanne. But how come I don't have to specify a classpath if I'm just running a simple program normally. If I'm just writing some code, then I can normally just write a class, compile it and run it without specifying any classpaths. I understand why I need to put the jar in the classpath, but how come in this situation I have to put my TestJar class in the classpath as well?

Thanks
12 years ago
Hi Wim,

Thanks for your answer, but no my class wasn't a part of a package, so it should have the default package.

I understand that when the javac or java commands are used, then any required classes are looked for first in the standard files that come as standard with a java installation and then in the locations specified by the classpath. So I've set the classpath for the jar and it compiles fine, but when I try to run it with the 'java' command it can't seem to find my TestJar class. How come it could find it when using the 'javac' command I wonder?
12 years ago
Hi there,

I'm using a third party library which is packaged as a jar in some code that I'm writing. I put the jar file in the classpath environment variable which allowed me to compile my TestJar class (which used the 3rd party library).

However, when I came to run my TestJar class using java, I got an exception that said that it couldn't find a class TestJar. I was running my program from the command line having cd'd into the directory that the TestJar file was in. I solved my problem by putting the folder that TestJar is in in the classpath, but I don't understand why that is necessary. When I run any other java class that I'm playing around with, I don't have to put it in the classpath and surely that will be using other libraries such as java.util etc.

Grateful for any help.

Thanks

Joe
12 years ago
That looks great. Thanks very much Sridhar.
13 years ago
Hi there,

I want to create an adjacency matrix for a graph as a 2d int array. I am reading in a list of edges consisting of 2 urls so:



for example, represents a link from the index page to the contact page.

At the moment I have created a HashMap<String, Integer> and I create a new entry in the hashmap for each new url that I find and associate it with an integer which will be it's index in the adjacency matrix. So now I can use the url to get the index of that url in constant time. I want to be able to do the reverse as well, ie get the url name by searching a HashMap, which should also be in constant time.

Do I have to make 2 HashMaps for this? It seems a waste of time and memory. Is there a data structure where I can use either side as the key?

Possibly I'm doing this in a bit of a stupid way anyway, but I really want to make the adjacency list as a 2d int array because I can do calculations of pagerank etc quicker that way.

Grateful for any thoughts.

Cheers

Joe

13 years ago
No, we don't seem to have access to log files unfortunately. Back to the drawing board.
13 years ago
Just to clarify. I started off trying to deploy an app that I had already had working on the tomcat installed on my laptop. I was just using the test app to try and simplify things.
13 years ago
Hi there,

Yes I did have the servlet and servlet-mapping tags in there, and correctly completed (I've got a little experience with servlets so I've done that hundreds of times before). I took them out just to see if it would work without them.

The log files aren't in the usual place, but I'll have a proper look tomorrow.

Cheers

Joe
13 years ago
Hi there,

I am having real problems deploying my web app on Tomcat 5.5.

I have Tomcat deployed on my laptop and it works fine for me, but I am trying to upload a simple webapp onto a remote server, but everytime I use the Tomcat Manager to deploy my app, I get the message:

FAIL - Failed to deploy application at context path /Test



according to material I have found on the web, there should be something wrong with my web.xml file. For the sake of just trying to get something to run I have simplified my whole app down to the web.xml file which is as follows:



I have copied the deployment descriptor header directly from the troubleshooting guide and have checked that it's the one for Tomcat 5.5. The WEB-INF directory is properly named, as is the web.xml file. I have turned Tomcat on and off serveral times, but I still get the message. This should be easy!

I'd be grateful for any help or suggestions.

Cheers

Joe
13 years ago
Hi Deepak,

I don't know if this is what you want to do, but maybe this code might help as an example:



So, the same instance of the A class is referenced by each instance of the classes that implement runnable. You can't tell whether threadOne or threadTwo will get the lock on that instance of A, but you can say with certainty that once one of the Threads gets the lock then the other Thread will be blocked until the first Thread's run() method has completed.

I hope that helps.

cheers

Joe
Hi Prasad,

Yes that makes perfect sense. Thanks very much for the commented example. I was a bit thrown by a Whizlabs question which was something like the following:



I had thought that this would fail at compile time because a non-static method (get) was accessing a static method (get1), but I can see now that it will compile fine because there will always only be one get1() method for a class (unless it's overloaded) so thee's no confusion as to which method will be accessed as there would be for non-static methods.

Cheers

Joe
I have done and that's the conclusion I came to, but I just wanted to confirm and maybe get some other opinions / info from some Ranchers.