Why java file name and class name are equal

could u explain why java file name and class name are equal in java

The relevant section of the JLS (?7.6):
When packages are stored in a file system (?7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:
* The type is referred to by code in other compilation units of the package in which the type is declared.
* The type is declared public (and therefore is potentially accessible from code in other packages).
This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
When packages are stored in a database (?7.2.2), the host system must not impose such restrictions. In practice, many programmers choose to put each class or interface type in its own compilation unit, whether or not it is public or is referred to by code in other compilation units.

Similar Messages

  • Where is the Package Name and Class Name for Android to Facebook SSO?

    Where is the Package Name and Class Name for Android to Facebook SSO?
    I am trying to fill these fields http://developers.facebook.com/docs/mobile/android/build/#ref for Facebook but i can't figure out what to place in Android Package Name and Andorid Class Name,
    same thing for the Android Key Hash, I followed this guide http://www.skoobalon.com/blog/2012/06/13/getting-the-android-key-hash-for-facebook-from-an -air-app/ but I am not sure if it is the right thing to do.
    I was thinking maybe the Pakage Name is air.com.myname.myappname (where com.myname.myappname is also the id used in the application.xml) and the Class name is  air.com.myname.myappname.MyDocumentClass ?
    Is there an official guide somewhere?
    Also do you guys know if there is somewhere a library we can use within AIR to do SSO on Facebook from Andorid?

    For what it's worth, I don't think a WiFi connection would be reliable enough. You wouldn't want your picture to freeze just because a neighbour has turned on their baby monitor. WiFi uses the same frequencies as a myriad of other devices, as well as all your neighbours' WiFi.

  • Class name and package name clashing

    When i have a class and a package with the same name, I cannot access classes in the package. For example I have 3 classes and 1 package as below
    - Test.java
    - PackageName.java
    + PackageName // this is a directory
    - MyClass.java
    Below are the codes of .java files
    Test.java
    =======
    public class Test { PackageName.MyClass a = new PackageName.MyClass ();}
    PackageName.java
    ===============
    public class PackageName{ }
    MyClass.java
    ==========
    package PackageName; public class MyClass { }
    I can compile PackageName.java and MyClass.java but not Test.java. It says
    cannot resolve symbol
    symbol : class MyClass
    location: class PackageName
    PackageName.MyClass a = new PackageName.MyClass ();
    But if I remove the PackageName.java, I can compile Test.java perfectly. I think when I use PackageName.MyClass, java thinks that I try to access an inner class MyClass of PackageName class, and that does not exists. Is there any way to solve this ambiguation, other than making the package name and class name different? Thank you very much.

    This works fine: just add an import to Test.java.
    import PackageName.MyClass;
    public class Test
        public static void main(String [] args)
            MyClass a = new MyClass();
    public class PackageName {}
    package PackageName;
    public class MyClass {}It's a pretty wacky, useless example, but it works.
    Plus I thought inner classes would have a dollar sign in their .class file names. When I compile this:
    public class OuterClass
        public static void main(String [] args)
            OuterClass outer = new OuterClass();
            System.out.println(outer);
        public String toString() { return "I'm an OuterClass"; }
        class InnerClass
            public String toString() { return "I'm an InnerClass"; }
    }I see two .class files: OuterClass.class and OuterClass$InnerClass.class
    Why make up examples like this? It's hard enough writing code, and it's easy to disambiguate for the compiler.

  • IPhoto won't recognize my iPhone 3Gs.  just says there's an apple iPhone, instead of the device name, and says there are no files to download, but there are 62 items on my phone... what's going on?

    iPhoto won't recognize my iPhone 3Gs.  just says there's an "apple iPhone" instead of the device name, and says there are no files to download, but there are 62 items on my phone... what's going on?  as far as I can tell I have everything up to date and it's always worked in the past.

    Have you already confirmed your Mac as a trusted device?  Try this:
    Lauch iTunes.
    Connect the Phone/iPad
    When it asks you to trust it, say yes.
    Now try again to import.

  • Error in File name or class name not found during Automation operation: 'CreateObj​ect'

    Hello Team,
    When I am trying to execute the below code i am getting the following error. Any help would be greatly appreciated.
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    If Not oFSO.FolderExists(SavePath) Then
    Set f = oFSO.CreateFolder(SavePath)
    Else
    End If
    53 4/11/2014 12:27:22 PM Error:
    Error in <NoName(4).VBS> (Line: 9, Column: 1):
    File name or class name not found during Automation operation: 'CreateObject'
    I have googled through the error and tried to re-register the scrrun.dll using regsvr32 eventhogh it is successfully registered, i am getting the following error. My PC is windows 7 32bit OS.
    any help is greatly appreciated.

    The following script class will write a log file entry. See if it will run for you.
    The script is using a class object that you might not have seen before. A little intro:  The top section is just for testing the class. Normally I just comment this out after the class is working well.  It should run right way. I would save the vbs file in the editor, That way when you are using autoactpath or currentscriptpath variables they will be able resolve the paths.
    Paul
    Attachments:
    LoggingCode_V2.VBS ‏5 KB

  • How to get the class name and field name dynamically

    Hi
    I have a class (ex: Contract) the fields (ex : a,b,c) .i need to get the class name and field name dynamically
    ex
    if( validation file for the field Contract.a){
    return contract.a;
    }else if(validation file for the field Contract.b){
    return contract.b;
    how to pass the field name and object dynamically
    Please help me .............
    Thanks in Advance..
    Edited by: 849614 on Aug 11, 2011 6:49 AM

    YoungWinston wrote:
    maheshguruswamy wrote:
    Agreed, but IMO, i still feel its best if there is no tie in between consumer class level details and the database it talks to. A service layer is needed in between them.Sounds like you've done a bit of this before. Me, I've either been a modeller/DBA, doling out data, or a nuts and bolts programmer (and actually more toolmaker than apps, but did a bit of that too).
    Do you know of a good book about the "middle ground" (ie, these service layers)? I understand it empirically, but haven't had a lot of exposure to it.
    Winston
    Edited by: YoungWinston on Aug 11, 2011 10:34 PM
    PS: Apologies. Edited my previous post, presumably while you were composing your reply, when I finally realized what '.filed' meant.Most of my work is in web development, never been a DBA :) . The biggest 'concern' in my shop is 'separation of concerns'. The UI group reports up to a different IT head, the DB group reports up to a different IT head and so on. The looser the coupling between these systems, the lesser the project costs (Integration, QA etc) are. Martin Fowler's books contain good information about separation of concerns in an enterprise environment. The two books which i recommend are
    [url http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420]Enterprise Application Architecture and
    [url http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=pd_sim_b_1]Enterprise Integration Patterns

  • HT1451 Why do the song names and cd name not show up on the IPod Shuffle?

    Why do the song names and cd name not show up on the Shuffle?

    MysticChyk wrote:
    Why do the song names and cd name not show up on the Shuffle?
    Err this is no longer April 1st you know.
    The iPod Shuffle has never had a 'display' on which track names can be shown. See http://www.apple.com/ipod-shuffle/ if you want an iPod which does have a display on which you can see the tracks names and even the album cover art then look instead at the bigger and more expensive iPod Nano http://www.apple.com/ipod-nano/ or iPod Touch http://www.apple.com/ipod-touch/
    PS. The current iPod Shuffle even though it has no display on which it can show the track names can read them out loud to you using a voice-synthesiser this is the VoiceOver feature described on the iPod Shuffle product page I listed above.

  • How to get the column name and table name from xml file

    I have one XML file, I generated xsd file from that xml file but the problem is i dont know table name and column name. So my question is how can I retrieve the data from that xml file?

    Here's an example using binary XML storage (instead of Object-Relational storage as described in the article).
    begin
      dbms_xmlschema.registerSchema(
        schemaURL       => 'my_schema.xsd'
      , schemaDoc       => xmltype(bfilename('TEST_DIR','my_schema.xsd'), nls_charset_id('AL32UTF8'))
      , local           => true
      , genTypes        => false
      , genTables       => true
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS
      , options         => dbms_xmlschema.REGISTER_BINARYXML
    end;
    genTables => true : means that a default schema-based XMLType table will be created during registration.
    enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS : indicates that a repository resource conforming to the schema will be automatically stored in the default table.
    If the schema is not annotated, the name of the default table is system-generated but derived from the root element name :
    SQL> select table_name
      2  from user_xml_tables
      3  where xmlschema = 'my_schema.xsd'
      4  and element_name = 'employee';
    TABLE_NAME
    employee1121_TAB
    (warning : the name is case-sensitive)
    To annotate the schema and control the naming, modify the content to :
    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
      <xs:element name="employee" xdb:defaultTable="EMPLOYEE_XML">
        <xs:complexType>
    Next step : create a resource, or just directly insert an XML document into the table.
    Example of creating a resource :
    declare
      res  boolean;
      doc  xmltype := xmltype(
    '<employee>
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>'
    begin
      res := dbms_xdb.CreateResource(
               abspath   => '/public/test.xml'
             , data      => doc
             , schemaurl => 'my_schema.xsd'
             , elem      => 'employee'
    end;
    The resource has to be schema-based so that the default storage mechanism is triggered.
    It could also be achieved if the document possesses an xsi:noNamespaceSchemaLocation attribute :
    SQL> declare
      2 
      3    res  boolean;
      4    doc  xmltype := xmltype(
      5  '<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6             xsi:noNamespaceSchemaLocation="my_schema.xsd">
      7    <details>
      8      <emp_id>1</emp_id>
      9      <emp_name>SMITH</emp_name>
    10      <emp_age>40</emp_age>
    11      <emp_dept>10</emp_dept>
    12    </details>
    13   </employee>'
    14   );
    15 
    16  begin
    17    res := dbms_xdb.CreateResource(
    18             abspath   => '/public/test.xml'
    19           , data      => doc
    20           );
    21  end;
    22  /
    PL/SQL procedure successfully completed
    SQL> set long 5000
    SQL> select * from "employee1121_TAB";
    SYS_NC_ROWINFO$
    <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceS
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>
    Then use XMLTABLE to shred the XML into relational format :
    SQL> select x.*
      2  from "employee1121_TAB" t
      3     , xmltable('/employee/details'
      4         passing t.object_value
      5         columns emp_id   integer      path 'emp_id'
      6               , emp_name varchar2(30) path 'emp_name'
      7       ) x
      8  ;
                                     EMP_ID EMP_NAME
                                          1 SMITH

  • Specify the output file path and print name when printing pages

    hi,
    how can i Specify the output pdf file path and print name when i am using the function PrintPagesSilent from AcroAVDoc Object.
    My Code :-
    Acrobat.AcroAVDoc doc = new Acrobat.AcroAVDoc();doc.Open(path,
    "temp");

    Dear Irosenth,
    i try with different format (doc, docx,  xls, jpg, bmp and txt) and it working successfully, but it give an random name for the file which saved in default folder for Adobe PDF print.
    you can use the following function:
    private void PrintPDF(string[] inputfilepath){
    foreach (string path in inputfilepath){
    Acrobat.
    AcroAVDoc doc = new Acrobat.AcroAVDoc();doc.Open(path,
    "temp"); 
    Boolean v = doc.PrintPagesSilent(0, ((Acrobat.AcroPDDoc)(doc.GetPDDoc())).GetNumPages() - 1, 0, 0, 1);doc.Close(1);
    and calling it by the following code:
    PrintPDF(System.IO.Directory.GetFiles("c:\\t\\printjob"));
    copy all files that you want to convert in side the mentioned path and run it program, then check the defualt print path for Adobe PDF printer.
    test it and reply me. thanks again

  • [svn] 2932: Updated manifests with recent changes to TCAL package and class names.

    Revision: 2932
    Author: [email protected]
    Date: 2008-08-20 14:01:37 -0700 (Wed, 20 Aug 2008)
    Log Message:
    Updated manifests with recent changes to TCAL package and class names.
    Reviewer: Jason
    Bugs: SDK-16531
    QA: No
    Doc: No
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-16531
    Modified Paths:
    flex/sdk/trunk/frameworks/fxg-manifest.xml
    flex/sdk/trunk/frameworks/mxml-2009-manifest.xml

    Revision: 2932
    Author: [email protected]
    Date: 2008-08-20 14:01:37 -0700 (Wed, 20 Aug 2008)
    Log Message:
    Updated manifests with recent changes to TCAL package and class names.
    Reviewer: Jason
    Bugs: SDK-16531
    QA: No
    Doc: No
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-16531
    Modified Paths:
    flex/sdk/trunk/frameworks/fxg-manifest.xml
    flex/sdk/trunk/frameworks/mxml-2009-manifest.xml

  • I lost all of my artist names and album names for my iTunes library. They are all now on one album. How can I get the album and artist names back?

    I lost all of my artist names and album names for my iTunes library. They are all now on one album. How can I get the album and artist names back?

    I have a script called ExportImport for this task, but it only runs in Windows.
    In principle something similar should be possible in AppleScript, but I don't currently have access to a Mac to write it myself.
    tt2

  • I am trying to deauthorize my audible account.  It says the user name and/or password are incorrect after I had just deauthorized the computer using the same user name and password.  They should be different correct?

    I am trying to deauthorize my audible account.  It says the user name and/or password are incorrect after I had just deauthorized the computer using the same user name and password and logging in to post this.  They should be the same password correct?

    Deauthorize Audible Account... always appears as a menu selection, even if you deauthorized Audible or never even had an account.
    Audible is a different account from iTunes and does not require the same username / password.

  • Why can't I set up an apple ID alternate email using my first name and last name?

    I am trying to set up an alternate address to my appleID using my first name and last name.  It keeps saying it is "rejected" but it gives me no reason.  I thought maybe someone was squatting on it, but when I try to send a note to it, it says that it isn't a valid address.  Does Apple prevent you from using an iCloud device with your name?  Seems odd since it allows other combinations of my name.

    Hello amg1957,
    Thanks for using Apple Support Communities.
    If you're trying to add an alternate email address to your Apple ID account, the email needs to be an existing valid email address.  To configure an alternate email address with a valid existing email, please follow the directions below.
    Alternate email address
    You can add one or more alternate email addresses for use with Apple services such as Game Center, FaceTime, Find My Friends, iMessage, and OS X notifications.
    Go to My Apple ID (appleid.apple.com).
    Select “Manage your Apple ID” and sign in.
    Add an alternate address:
    Select Add Email Address, then enter your alternate address. Apple will send a verification email to that address. Didn't receive the email?
    Follow the instructions in the email to verify the address.
    Edit an alternate address:
    Select Edit next to the address, then enter the new address. Apple will send a verification email to that address. Didn't receive the email?
    Follow the instructions in the email to verify the address.
    Delete an alternate address: Select Delete next to the address.
    Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support
    Take care,
    Alex H.

  • SharePoint 2010 Web Analytics showing user Display Name and Account Name from the same user

    Hi!
    Since July, 16th 2012 the Web Analytics Daily Unique Visitors reports started to show almost the double of visitors we used to have on our Web Application. Here are some of the data (I intentionally deleted the weekend data):
    10/7/2012 2.497
    11/7/2012 2.723
    12/7/2012 2.722
    13/7/2012 2.699
    16/7/2012 5.055
    17/7/2012 4.963
    18/7/2012 4.954
    19/7/2012 4.998
    20/7/2012 4.965
    23/7/2012 5.117
    24/7/2012 5.012
    25/7/2012 5.071
    As you may notice the data jumped from around 2.700 unique visitors to around 5.000 unique visitors. As the number of permissioned users remains constant it is pretty odd. I also checked the Number of Page Views report and see no change on its behavior.
    The number of page views remained constant.
    So I went to look the Top Visitors report and understand why the visitors number almost doubled. The analytics started to count the users Display Name and Account name as two different visitors with a different number of page views. Let me show you an example
    from yesterday (July, 25th) Top Visitors report:
    #     Visitor                  Page Views    %
    1    Cinthia XXXXXXXXXX    359        0,55%
    5    Giselle XXXXXXXXXX     143        0,22%
    7    Aline XXXXXXXXXX       138        0,21%
    15  nt\cmazevedo              111        0,17%
    60  nt\gbsantana                 69        0,11%
    73  nt\aglsiqueira                 65        0,10%
    "Cinthia" and the account "nt\cmazevedo" are the same person. The same is applied to "Giselle" / "nt\gbsantana" and "Aline" / "nt\aglsiqueira".
    As I stated this is an example from July, 25th. If I checked the same report from a period before July, 16th I can only see the users Display Name as "Visitors". No account name is displayed or counted as a different visitor.
    About the environment:
    We have two SharePoint 2010 farms: a "corporate" and a "enterprise". The corporate farm contains four web servers and a central administration servers with publishing services. The enterprise farm contains two servers running User Profile Services, Search
    Services and some others. Our main version is the SP1 with June/2011 Cumulative Update with a few more hotfixes applied.
    This behavior on analytics is affecting all web applications (we have more than 20) installed on this farm and my company Support team said that no change were made on SharePoint on the weekend the problem started.
    Does anyone have any tip about what is going on?
    Thanks in advance!

    Hi, Manas!
    First of all thanks for your interest on this issue but I don't think it is related to the User Profile or the Active Directory.
    I checked both records and there was no change on the Display Names. All the users have "full names" as display names (first + middle + last name) and not logins as SharePoint is displaying on this report.
    But I did a test yesterday and checked the results today confirming that just the access been made using a specific server are causing this. Explaining it better:
    I have four web servers on my farm named from P01 to P04. Then I created this test script:
    Step 1: Change local HOSTS file to point the web application on the server P01.
    Step 2: Access site "A"
    Step 3: Access site "B"
    Step 4: Close the browser.
    Step 1: Change local HOSTS file to point the web application on the server P02.
    Step 2: Access site "C"
    Step 3: Access site "D"
    Step 4: Close the browser.
    Step 1: Change local HOSTS file to point the web application on the server P03.
    Step 2: Access site "E"
    Step 3: Access site "F"
    Step 4: Close the browser.
    Step 1: Change local HOSTS file to point the web application on the server P04.
    Step 2: Access site "G"
    Step 3: Access site "H"
    Step 4: Close the browser.
    I asked three users to execute that script. The results: All access to the sites "C" and "D" were registered on Web Analytics with the user account name such as "nt\cmazevedo". All the other sites registered the user Display Name correctly such as "Cinthia
    XXXXXXXXXX".
    With this test we could isolate the problem just on the server P02. It doesn't occur on the others. Now my support team is trying to find any configuration difference between this server and the other three that could point for the root cause.
    I am also looking for some information regarding the service responsible for this task ("transform the account name into a display name") to understand why it doesn't work on one server and works on the others.
    Thanks!

  • Getting the user name and computer name

    I've been trying to find out how to do this, but can't seem to get it.
    I have an AIR application that needs to get the user's login name, and computer name for verification.  I can't find anywhere to do this.  Is AIR able to get this information? Is there work arounds if there isn't?
    It won't ever be a web app, just an AIR app.

    What I did in Air 2 to accomplish that is the following:
                   public function getHostName():void {
                        if(NativeProcess.isSupported) {
                             var OS:String = Capabilities.os.toLocaleLowerCase();
                             var file:File;
                             if (OS.indexOf('win') > -1) {
                                  //Executable in windows
                                  file = new File('C:\\Windows\\System32\\hostname.exe');
                             } else if (OS.indexOf('mac') > -1 ) {
                                  //Executable in mac
                             } else if (OS.indexOf('linux')) {
                                  //Executable in linux
                             var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
                             nativeProcessStartupInfo.executable = file;
                             var process:NativeProcess = new NativeProcess();
                                  process.addEventListener(NativeProcessExitEvent.EXIT, onExitError);
                                  process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutput);
                                  process.start(nativeProcessStartupInfo);
                                  process.closeInput();
                   import utls.StringHelper;
                   public function onOutput(event:ProgressEvent):void {
                        var strHelper:StringHelper = new StringHelper();
                        var output:String = event.target.standardOutput.readUTFBytes(event.target.standardOutput.bytesAvailable);
                             output = strHelper.trimBack(output, "\n");
                             output = strHelper.trimBack(output, "\r");
                        trace('"'+output+'"');
    The package that I used is from the manual:
    package utls
         public class StringHelper
              public function StringHelper()
              public function replace(str:String, oldSubStr:String, newSubStr:String):String {
                   return str.split(oldSubStr).join(newSubStr);
              public function trim(str:String, char:String):String {
                   return trimBack(trimFront(str, char), char);
              public function trimFront(str:String, char:String):String {
                   char = stringToCharacter(char);
                   if (str.charAt(0) == char) {
                        str = trimFront(str.substring(1), char);
                   return str;
              public function trimBack(str:String, char:String):String {
                   char = stringToCharacter(char);
                   if (str.charAt(str.length - 1) == char) {
                        str = trimBack(str.substring(0, str.length - 1), char);
                   return str;
              public function stringToCharacter(str:String):String {
                   if (str.length == 1) {
                        return str;
                   return str.slice(0, 1);
    And sorry for the miss topic I just realized that it is on flex topic, but I post it either way it may be useful for anyone

Maybe you are looking for

  • Is there a way to split a very large 1 page pdf into letter size multiple page pdf?

    I often have very large single page pdfs that need to be printed onto letter size paper.  Usually I don't have access to the printer where I'm working so I have to send the file to someone for printing.  I have AXI pro, they don't.  I want to make su

  • How to search special characters in a string

    Hi all, I want to search special characters in all string columns and all rows in the table. The table has about 5 string columns and about 5.000.000 rows. For each row and column, I have to search entries, which included special characters like ", !

  • Insert subtotals in blank cells in Excel

    I just completed a complicated exercise where I expanded upon an existing table using VLOOKUP.  My next step was to insert subtotals in each of the new columns of the modified table.  But, the original subtotals in the original table were text, not f

  • Unable to open Bridge CS6 after installing Adobe Photoshop Elements 8

    I have been using Bridge CS6 successfully until I installed Photoshop Elements 8 to use with a scanner I bought.  After the installation, when clicking on Bridge CS6 it opens Bridge CS5.   I had a look at some of the forums and tried Ctrl-clicking on

  • Media format is not supported on OS7, but OS6 is working

    Why is this URL Media on OS6 Browser well working and on the new OS7 I'm getting an error? Ideas?! http://bit.ly/tp671l Or: tvthek.orf.at/l Very long buffering (about 2min) and seems to not swith into WAP mode for streaming.... After that: error: not