A small Problem in java

P

pinto

I have a small java Problem. In my project, some .java files are
created and placed in the destination directory specificied by the
user. In those .java files we declare the package name.It works when we
the destination directory specified by the user does not have a space
but it does not work when there is space in the destination directory.
For eg.

package new folder.AppSingleton // does not work
package new_folder.AppSingleton //it works

How can i eliminate this problem. I want "javac" not to give an error
when i give a space in the package name. Please suggest some ideas!!!!!
 
K

kaeli

vinay080 said:
package new folder.AppSingleton // does not work
package new_folder.AppSingleton //it works

How can i eliminate this problem. I want "javac" not to give an error
when i give a space in the package name. Please suggest some ideas!!!!!


Change the space to an underscore during processing somewhere.
Spaces are not allowed in package names.

--
 
M

Mike Schilling

pinto said:
I have a small java Problem. In my project, some .java files are
created and placed in the destination directory specificied by the
user. In those .java files we declare the package name.It works when we
the destination directory specified by the user does not have a space
but it does not work when there is space in the destination directory.
For eg.

package new folder.AppSingleton // does not work
package new_folder.AppSingleton //it works

How can i eliminate this problem. I want "javac" not to give an error
when i give a space in the package name. Please suggest some ideas!!!!!

Whitespace is not legal in Java identifiers, including package names. See
http://java.sun.com/docs/books/jls/first_edition/html/3.doc.html#40625 for
the rules about legal identifier names and don't allow the user to specify
anything that violates them.
 
B

Bryce

I have a small java Problem. In my project, some .java files are
created and placed in the destination directory specificied by the
user. In those .java files we declare the package name.It works when we
the destination directory specified by the user does not have a space
but it does not work when there is space in the destination directory.
For eg.

package new folder.AppSingleton // does not work
package new_folder.AppSingleton //it works

How can i eliminate this problem. I want "javac" not to give an error
when i give a space in the package name. Please suggest some ideas!!!!!

Don't use a space in a package name. You cannot do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top