Re: Can two classes with the same co-exist?



On Aug 29, 1:45 pm, laredotornado <laredotorn...@xxxxxxxxxxx> wrote:
Hi,

I'm using Java 1.5 . I currently have two imports that use the same
class name:

import javax.faces.application.Application;
import com.myco.nps.im.dto.applications.Application;

Unsurprisingly, when I compile, I get the compilation error

    [javac] /export/third-party/etsbea/staging/wls_9.2.2/
nps_config_gui/src/com/myco/npsconfig/jsf/controllers/
AddApplicationPage.java:27: javax.faces.application.Application is
already defined in a single-type import
    [javac] import com.myco.nps.im.dto.applications.Application;

I didn't write either class but I need them both.  Any way I can get
around this compilation error?

By referring to one or both classes by fully-qualified name
(javax.faces.application.Application,
com.myco.nps.im.dto.applications.Application) in the class, rather
than importing both. import statements do nothing more than tell the
compiler which fully-qualified name to expand a short name to; they
have no impact on which classes are available.

-o
.



Relevant Pages

  • Framework SP2
    ... We applied .Net framework to our dev server and now we get the compilation ... Microsoft Visual Basic .NET Compiler version 7.10.6310.4 ... Line 14: Imports Microsoft.VisualBasic ...
    (microsoft.public.dotnet.framework)
  • RE: Compile Problem: BC31011- Access is denied
    ... An error occurred during the compilation of a resource required ... > dll': Access is denied. ... > Line 14: Imports Microsoft.VisualBasic ... > Line 29: Namespace ASP ...
    (microsoft.public.dotnet.framework.aspnet)
  • Compile Problem: BC31011- Access is denied
    ... An error occurred during the compilation of a resource required ... dll': Access is denied. ... Copyright Microsoft Corporation 1987-2002. ... Line 14: Imports Microsoft.VisualBasic ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: redundant imports
    ... inclusion of modules in c is a purely preprocessing textual matter (compilation is deferred to after the fact), i guess, so that such things are possible. ... That doesn't change the fact that code-1 needs names from code-3, and just because code-3 is imported elsewhere is no reason to think that code-1 magically gets its names too. ...
    (comp.lang.python)
  • Error During compilation
    ... I m using vb.net and framework 1.1 whithout VisualStudio. ... 'My Imports NameSpaces ... Imports Microsoft.VisualBasic 'compilation and code generation for Visual ... Public Shared Sub doExcelExport(ByVal myDataGrid As Control) ...
    (microsoft.public.dotnet.framework.aspnet)