Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

mike seluker

+ Follow
since Nov 21, 2001
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 mike seluker

Originally posted by Mark Fletcher:
Ive got it working, heres what I did.

Running the last line successfully runs the driver program
Thanks for the pointers Michael!
To Mike, can you try this on your PC and see if you get the same results?

Hey Mark,
I've checked your code and it worked. Also I know the reason why your first code type didn't work.
Here you have created "javalibs" directory and then compiled everything. If you remove "javalibs" directory it won't work. The reason is the presence of and in "." directory. Try this
Directory structure: and are present in /tmp
tmp> javac -d .
tmp> javac -d .
tmp> javac -classpath ./
Won't work.
Now do this.
tmp> mv
tmp> mv
tmp> javac -classpath ./
Works gr8. That means the presence of java file gives the problem.
What a weird thing.....
18 years ago

Originally posted by Rob Ross:

Full article here:
(Item #8)

Yeah I know ,And because these stupid change (which must have broken codes for many), I've to change my whole application which is already in production....
18 years ago
Hey Mark,
I've tested your code and got the error. And the interesting stuff is if you add the package structure ("package org.markfletcher.somepackage") to the file you won't have to even import the A & B classes. Everything works fine.
There may be bug in jdk1.4 compiler.
Look for posting "package/classpath problem with 1.4" under my name. I've already file a bug to SUN and they accepted it as a new bug in the compiler.
The problem which you r facing might have to do with the bug since you are trying to use classes where some classes has package structure and some do not.
18 years ago

Originally posted by Greg Brouelette:

Mike: I just want to make sure I understand what you're saying because now it might be "me" that's misunderstanding.
Are you saying that is in the com.hamilsci package BUT it's not in the com/hamilsci directory? Instead it's in the . directory. However, when you compile it you want it placed in the com/hamilsci directory ?
If so then may I ask why? I'm not flaming or anything I just want to know if there is a business case for placing the source files in a directory structure that doesn't match the package structure.

What I'm saying is that There are two places can be present BUT A.class will ALWAYS has to be in com/hamilsci folder. (Remeber contains the following statement
"package com.hamilsci;" )
The first place for is : "." in this case u have to use "javac -d ." and u r issuing this command from "." directory. Here the class file will still be in com/hamilsci folder.
The second place for is: "./com/hamilsci/" In this case u have to use "javac" and u r issuing this command from "./com/hamilsci" folder. Here also the class file will be in "./com/hamilsci" folder.
It purely depend on person where he want to put the java file. Both are acceptable. As far my knowledge I don't see any specific business rule to do that.
I hope I'm clear but if you still have any doubt I'll happy to solve it..
18 years ago

Originally posted by Greg Brouelette:

As I've said, that is not a limitation, I think you misunderstood Rob. Let me try to help clear this up with an example.

what you have said about the location of to in ./com/hamilsci is true for clear understanding. But I can have the in "." directory and then I can compile "javac -d ." which will put the A.class file in "./com/hamilsci". What I am saying that it the A.class file HAS to be in ./com/hamilsci folder not the
Also about the limitation, you have given a very clear example and that's what my understanding was. This works in jdk1.3 not with jdk1.4. Yesterday I file the BUG to SUN and they have accepted it. Its a new bug in jdk1.4 and the bug id is :4650921. You will be able to see it in BUG database in a day or two.
18 years ago

Originally posted by Rob Ross:
Two things:
first, your directory structure must match your package hierarchy. If you declare that class A is in package com.hamilsci, then your source file MUST be in a directory tree ./com/hamilsci/
What u r saying is not always true. My dir structure is /usr/local/java/examples/com/hamilsci
And I should have either in /usr/local/java/examples/com/hamilsci or /usr/local/java/examples.
In second case however while compileing I've to use javac -d .
The "./" in front of com just means that whatever directory the com directory is in, THAT must be in your classpath.
CLASSPATH variable contains both the directory structure. I mean i've correct CLASSPATH setting
For example, say your com directory is in a directory called foo:
you must include the directory "foo" in your classpath. That way, the compiler and the JVM can location your A.class file in the right package.
Your next problem is that you must understand ALL classes are in a package. The package is the basic unit of organization in a java program. If you don't explicitly include a package statement in your source file, that class gets added to the "default" package.
However, this "default" package should only be used for "hello-world" type applications. If you're going to be creating more than one class for your java app, don't use the default package. You cannot import classes from the default package in jdk1.4, so they're basically useless to you. I would suggest for your program that you put your class B in the same package as class A.
Does you mean that from jdk1.4, you CANNOT make use of classes from default package(without package structure). If that's the case I think this limitation will break many people's code. I know its good to use the package sructure but right now we hava already developed an application using classes from default packages. I CANNOT chn that. I've that limitation. I'd appreciate you can suggest any other solution.
[ March 11, 2002: Message edited by: Rob Ross ]

18 years ago
I've two classes. one class has a package structure and other does not. when i try to compile the class (having package structure) which has a reference to other class (which doesn't have package structure), I get error "cannot resolve symbol"
package com.hamilsci;
public class A {
public A() {
B obj = new B();
class A is in dir /usr/local/java/examples
public class B {
public B() { }
class B is in dir /usr/local/java/helperclasses and doesnot have package structure
When I tried to compile A without the package statement, everything works fine. But when I add package structure to Class A, I cannot compile . The error Message is :cannot resolve symbol
symbol : class B
location: class com.hamilsci.A
B obj = new B();
I'm using JDK1.4 and I've tried setting the CLASSPATH.
Any help would be highly appreciated.
18 years ago

Originally posted by Mark Spritzler:
Congrats Mike

special thnx to u Mark...... and also congrats.....

Originally posted by Roman Rytov:
What's your next step?

I'll be focusing on UML or EJB.....
I woke up this new year and had this pleasant suprise for me. I passed with 149/155!!
Here is the break down..
Score: 149
Comment: This report shows the total points that could have been awarded in each section and the actual number of points you were awarded. This is provided to give you per-section feedback on your strengths. The maximum possible # of points is 155; the minimum to pass is 124. General Considerations(maximum = 58): 58 Documentation(maximum = 20): 20 GUI(maximum = 24): 22 Server(maximum = 53): 49
I'd like to thanks all u guys for making this forum a great source of information...
It really helped me a lot in successfully completing my assignment..
Wish u all a Very Happy New Year..

Originally posted by Mathew Sam:
In the LockManager class i have only two synchronized methods.Do I need to sychronize the access to the HashMap like
synchronized(locks) { }
class LockManager {
private HashMap locks = new HashMap();
pubilc synchronized void lock (){
// Access HashMap
pubilc synchronized void unlock (){
// Access HashMap

You don't have to synchronized on hashmap if u r synchronizing on methods. You synchronize on either methods or hashmap but avoid on both.
Hi all,
I'm on the stage of submitting my assignment but facing a common weird problem wrt classpath. I've a shared.jar file which will be used by my client.jar and server.jar executables
The problem is i'm not able to set the classpath
I tried the following options
A) set classpath=%classpath%;./shared.jar
java -jar client.jar
getting "FileNotFoundException" suncertify/coreclasses/FBNConstants file not found
B) java -classpath ./shared.jar -jar client.jar
still getting the same exception
I've read somewhere in the post that -jar ignores the classpath variable. So is there any solution for this??
I've one solution, I dunno whether it is acceptable or not?
In the manifest file of client.jar I've set
Main-Class: suncertify.gui.StartUp
Class-Path: ./shared.jar
and now if i run
java -jar client.jar everything works great. The only limitation is that the shared.jar has to be present whereever client.jar is. But still, the user has the liberty of copying(client.jar and shared.jar) anywhere.
Is this acceptable? Guys Please reply ASAP....
thnx in adv.
PS: "When you use -jar option, jar file is the source of all user classes and other classpath settings are ignored".
Found this comment in the java docs..
[This message has been edited by mike seluker (edited December 13, 2001).]
consider a situation where client A gets the lock on record R1. And just before reading/modifying that record, CPU switches the context and some other process gets the CPU. Now client A doesn't get the CPU for (10000) period u specify and according to your logic, you will unlock the record R1. Also let say client B was waiting for same record R1. And client B gets the record and in the middle of processing the record. At the same time client A gets the CPU, so it will now try to read/modify the record R1 (assuming it is still having the lock, which is not true). Won't this lead to corrupt data.
Please comment...

Originally posted by Andre Mermegas:
I was thinking of doing something like
wait(10000); if its a full database lock
and there are current record locks.If the
records are'nt unlocked by then, there may
be a problem with the client who made the
original lock.
what ya think?

I think you need not have to lock before reading if u r not going to modify it....
That's how i've done it... in case of modification, you should obtain the lock for reading and subsequently modifying...
how u have implemented the -1(DB level) lock?? i'm having a hard time implementing it...

Originally posted by Richard Walter:
Just would like to confirm that you do not need to lock the record if you just want to get a record from the database with no itention of modifying it.
My concern is that without locking the record, another client might be modifying the record while Im reading it, therefore I might get some erroneous data in my record.
I presume this will not happen as the getRecord and modifyRecord are both synchronised in the Data clas, thus preventing a read while a record is being written.
In my current implmentation I lock the record before reading it. If a connection attempts to read a record without obtaining a lock first an exception is thrown. I think this is all uncesssary.
am I right in my thinking or am I missing something?

Mark can u please elaborate ur u have implemented it? i didn't get what u said.
I'm really having a hard time implementing -1 lock.. still working on it..

Originally posted by Mark Spritzler:
What about a little bit of recursion. That way you don't have to keep track of who has locks, and who is waiting.
It will wait just like the rest of the threads for a lock on a record that someone else has. Eventually it will get all the locks, and you will have a database lock.
Just an idea