File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Package name part of a class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Package name part of a class?" Watch "Package name part of a class?" New topic
Author

Package name part of a class?

Viralraj Upadhyay
Greenhorn

Joined: Nov 10, 2006
Posts: 22
I read this somewhere "Package name is part of the class and cannot be modified except by recompiling the class." I did not get this clearly. Can anybody throw light on this?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

Hmmm; that seems pretty clear to me. If you have a class like



and you compile it, the package name "com.foo.you" is included in the Foo.class file. Moving the Foo.class file to a different directory doesn't change the fact that class Foo is in package com.foo.you . The only way to change that is to edit the "package" statement in Foo.java and recompile it.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Package name part of a class?
 
Similar Threads
Creating a Class with a Static Method
external variable in java
Servlet Error
what is an unnamed package...
connecting java application to JAVADB database