• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I am close to submit - quetions

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Mike Tilling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic