| Author |
How to make a specify client
|
filson sun
Greenhorn
Joined: Mar 06, 2011
Posts: 12
|
|
I have make a Constructor to make the user to have a specify program , but I do not know how to make the specify class that contains the user's configuration info to be the *.java
file (with the java language). who can help me ,Thank you !
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16690
|
|
Can you please elaborate? I am thinking there is a translation problem here, because I can't understand what you are asking.
And BTW, welcome to the JavaRanch.
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
filson sun
Greenhorn
Joined: Mar 06, 2011
Posts: 12
|
|
Henry Wong wrote:Can you please elaborate? I am thinking there is a translation problem here, because I can't understand what you are asking.
And BTW, welcome to the JavaRanch.
Henry
Thank you for paying attention to my question. My problem is that I am making a C/S program ,then I want to make the Client program with the configuration that let the user to fill it.
the Class is
"Class ClientFrame{
public ClientFrame(String hostIp, String hostPort){
........
}
}"
where,I want to save the specify instance of the ClientFrame ,then I can make it to the client user ,and he or she can use the *.java or *.jar to connect the host user computer.
But, I do not know how to save the specify instance of the ClientFrame ,and save it like the *.java or *.jar.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16690
|
|
filson sun wrote:
where,I want to save the specify instance of the ClientFrame ,then I can make it to the client user ,and he or she can use the *.java or *.jar to connect the host user computer.
But, I do not know how to save the specify instance of the ClientFrame ,and save it like the *.java or *.jar.
To directly answer your question. You can pre-instantiate the objects that you want, and serialize them to a file. Then your program can simply derserialized the instances from those files.
However, I am guessing that this is *not* optimal. In your description, you sound like you want to set configurations. It might be a better idea to simply create configuration files, in any format that you want; and during application start up, load the configuration files, to instantiate the objects that you need.
Henry
|
 |
filson sun
Greenhorn
Joined: Mar 06, 2011
Posts: 12
|
|
Henry Wong wrote:
filson sun wrote:
where,I want to save the specify instance of the ClientFrame ,then I can make it to the client user ,and he or she can use the *.java or *.jar to connect the host user computer.
But, I do not know how to save the specify instance of the ClientFrame ,and save it like the *.java or *.jar.
To directly answer your question. You can pre-instantiate the objects that you want, and serialize them to a file. Then your program can simply derserialized the instances from those files.
However, I am guessing that this is *not* optimal. In your description, you sound like you want to set configurations. It might be a better idea to simply create configuration files, in any format that you want; and during application start up, load the configuration files, to instantiate the objects that you need.
Henry
Thank you! I will use your second idea
|
 |
 |
|
|
subject: How to make a specify client
|
|
|