Problems running a jar of RMI
Hello everyone,
Once again I need your help.
I realized in a java-based java RMI with Netbeans 6.5. If I try to run it from NetBeans I have no problem, but when I create the jar and start running me wrong.
In particular, I saw that this is an error path, it can not find the file policy.
To upload the file as the application needs I have used education this.getClass (). GetResourse ("relative path") therefore should not give me these errors.
Why not work?
Thanks.
Re: Problems running a jar of RMI
If i am not mistaking then the files inside the jar may get corrupted because of some reason but have u observe that is the policy file is inside the jar?
Re: Problems running a jar of RMI
yes, the file is inside them.
I try to print the directory where to go find the file and leaves me this:
c: / Users / Asus / Documents / NetBeansProjects / Ticket_Distributor / dist / Ticket_Distributor.jar! / is / files / server.policy
that means? why is the. jar?
Re: Problems running a jar of RMI
Quote:
that means? why is the. jar?
Precisely because the policy file is inside the jar, right?
I say maybe, but:
Quote:
c: / Users / Asus / Documents / NetBeansProjects / Ticket_Distributor / dist / Ticket_Distributor.jar! / is / files / server.policy
It's not that is the character '!' immediately after the extension. jar to be the problem?
What makes us there?
Re: Problems running a jar of RMI
After quick consultation document Sun "Accessing Resources" I think the problem is precisely that '!' in the path of the resource.
The reason is explained in part highlighted:
Quote:
Resources, names, and contexts
A resource is identified by a string consisting of a sequence of substrings, delimited by slashes (/), followed by a resource name. Each substring must be a valid Java identifier. The resource name is of the form or ShortName shortName.extension. Both ShortName and extension must be Java identifiers.
The name of a resource is independent of the Java implementation, in particular, the path separator is always a slash (/). However, the Java implementation controls the details of how the contents of the resource are mapped into a file, database, or other object containing the actual resource.
The interpretation of a resource name is related to a class loader instance. Methods implemented by the classloader class do this interpretation.
Why in identifier is valid, except for the first character, you have the other characters are letters, numbers, the character '_' or the '$'.
So it is not the character '!'.