File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes I am close  to submit - quetions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "I am close  to submit - quetions" Watch "I am close  to submit - quetions" New topic
Author

I am close to submit - quetions

Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Hi

-The client side of my application uses pictures (icons), I could not run the client after being packaged in a JAR file, the program can not access these pictures within the JAR file, what I should do to fix this problem?

- On the server side can I always start the RMI server on the same port (1099), do I have to give the user the option to change this port, if so, will this be done via a GUI on the server side, I do not actually want to implement a GUI on the server side, do I have to?
If I have to specify the registry port number, the client will have to know the port number from the server side, isn�t this confusing?

- It happens that the exception occurs after having the file lock or the record lock ownership (in my implementation, the lock and the unlock processes are invoked in the server side, I mean on the Data layer) do I have to treat this case, it is pretty complicated to check within the try block, if the thread has the ownership of the file or the record, when an InputOutput or RemoteException occur, do we have to simply exit the application, I think this is the easiest was, is it acceptable? In this case, when an exception occurs, the client will be informed that the server has stopped and the later needs to be restarted, how did you deal with the exceptions?

-What does the client need to know if a BoundException occurs?


Best Regards
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11477
    
  94

Hi Mike,

-The client side of my application uses pictures (icons), I could not run the client after being packaged in a JAR file, the program can not access these pictures within the JAR file, what I should do to fix this problem?
You might want to write a very small program that demonstrates using pictures, show us your directory structure, and show us the command you use to create your jar file. We can then replicate your steps locally and work out what is wrong.

On the server side can I always start the RMI server on the same port (1099), do I have to give the user the option to change this port, if so, will this be done via a GUI on the server side, I do not actually want to implement a GUI on the server side, do I have to?
Two totally seperate issues here - one is the port number and the other is a server GUI.

Personally I believe that the application is much nicer if it has the ability to run on a different port than 1099. Imagine if every Java server application only ran on port 1099 - you would need one server per application. However you dont get points for going beyond the requirements - you can make a design decision here.

If you do not have a GUI for the server, how do you specify where the data file is located?

If I have to specify the registry port number, the client will have to know the port number from the server side, isn’t this confusing?
Maybe a little. But normally when you start at a company you are told certain things such as what server hosts your email, what server hosts the internal website ... Why not also be told what port this application needs the very first time it runs?

- It happens that the exception occurs after having the file lock or the record lock ownership (in my implementation, the lock and the unlock processes are invoked in the server side, I mean on the Data layer) do I have to treat this case, it is pretty complicated to check within the try block, if the thread has the ownership of the file or the record, when an InputOutput or RemoteException occur, do we have to simply exit the application, I think this is the easiest was, is it acceptable? In this case, when an exception occurs, the client will be informed that the server has stopped and the later needs to be restarted, how did you deal with the exceptions?
You might want to break this out into a seperate topic.

What does the client need to know if a BoundException occurs?
When can that exception occur?

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Mike Tilling
Ranch Hand

Joined: Feb 17, 2006
Posts: 86
Anderwew,

I package the files into a jar file like that

jar -cvf myFile.jar directory1\*.class directory2\*.gif

this is an example from my program:

ImageIcon image = new ImageIcon(Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("directory2\picture.gif"));

buttonY.setIcon(image)

When I run this program, Null Ponter Exception will be thrown

Best Regards
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11477
    
  94

Hi Mike,

You need to provide a bit more than that for us to determine what is wrong - there is just too little to go on, and there are mistakes in what you have provided (for example the single line of source code does not have the required number of closing brackets ')' and should not be using a backslash).

When I suggested creating a small sample program, I meant something more akin to:Compiling that, putting it in a jar file, moving the jar file to a different directory, and then running it all seems to work for me:



So perhaps you could start with a similarly small program, get that working, then slowly increase it's complexity until you determine where the problem is with your real code.

Regards, Andrew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I am close to submit - quetions