Conditional import in Java?

Hi All,
Is some way available to custom import packages? For eg, I have a mock_middleware package used for testing & initial development process. But there is another package called middleware which is being simultaneously developed. I want to set a flag, which when true - one of these package files are imported and flag false, the other package is imported.
Both the packages will have same class, function declarations.
Thanks a ton for any insights.
Regards,
Chandra Mohan

You seem to be using some non-standard terminology (since I assume you want this switch to take effect at runtime).
Importing refers to something like this: import java.io.IOException;
import java.sql.*; Importing has precisely zero effect at runtime. All it does is allow you to not have to specify fully qualified class names. That is I can do this catch (IOException exc) {}
Connection con = getConnection(); instead of having to do catch (java.io.IOException exc) {}
java.sql.Connection con = getConnection(); Now, if you want to first import one class and then the other, you have to change your import statements. If you have packages mock_middleware and middleware, and both have class Foo, then you could, for instance, have precisely one of the following lines uncommented. // import middleware.*;
import mock_middleware.*;
Foo foo = new Foo(); You can't change imports at runtime, and it would make no sense to do so, since importing has no effect at runtime anyway.

Similar Messages

  • How to import a java class in a JSP

    Hi All,
    I have a java class file called myTest.class (i made after compilation of myTest.java). I have a JSP page that uses this java class file.
    These 2 files are in same folder called c:/test
    and iam importing this java class file into my jsp file and that too at the start of this jsp file:
    <%@page import="myTest" %>
    BUt iam getting an error ..............when iam running this JSP page:
    /opt/bea81sp2/user_projects/domains/wliDomain/./Managed2/.wlnotdelete/extract/Managed2_myTest_myTest/jsp_servlet/__test.java:20: '.' expected
    probably occurred due to an error in /test.jsp line 5:
    <%@page import="myTest" %>
    Please advise how to solve this problem
    -sangita

    Don't bother with the import
    when iam not importing this class file into my JSP, then on my JSP, the class file is not found.
    Here is my code: and these 2 class file are in c:/test
    import org.apache.tools.ant.taskdefs.Ant;
    import org.apache.tools.ant.taskdefs.Property;
    import org.apache.tools.ant.types.*;
    import org.apache.tools.ant.*;
    import org.apache.tools.ant.taskdefs.ExecTask;
    import org.apache.tools.ant.types.Commandline;
    import java.io.File;
    * Creates an Ant project to run an Ant build
    * @author myself
    * @version 1.0
    public class RunTest extends Ant {
        String applicationName;
        String buttonClicked;
        String boxName;
        String targetName;
        public void applicationName(String applicationName){
         this.applicationName = applicationName;
        public void boxName(String boxName){
         this.boxName = boxName;
        public void buttonClicked(String buttonClicked){
         this.buttonClicked = buttonClicked;
      public RunTest() {
    public void goTest() {
         if(this.buttonClicked.equalsIgnoreCase("deploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
           this.targetName = "deploy-scsmail-testnet";
         if(this.buttonClicked.equalsIgnoreCase("undeploy") && this.applicationName.equalsIgnoreCase("scsmail") && this.boxName.equalsIgnoreCase("testnet")){
           this.targetName = "undeploy-scsmail-testnet";
        Project project = new Project();
        project.init();
        System.out.println("printing 1 ....");
        ExecTask exec = new ExecTask();
        exec.setProject(project);
        exec.setExecutable("/opt/bea/weblogic81/server/bin/ant.bat");
         exec.setDir(new java.io.File("/export/home/beamon/bin"));
         Commandline.Argument arg = exec.createArg();
         // arg.setLine("-f scsmail.xml test -listener org.apache.tools.ant.XmlLogger -logfile D:/antProject/src/log.xml");
         arg.setLine("-f build.xml "+ targetName + " -listener org.apache.tools.ant.XmlLogger -logfile /export/home/beamon/bin/log.xml");
         System.out.println("printing 2....");
        //exec.setOutput(new File("D:/antProject/logs/prob.txt"));
        exec.execute();
        System.out.println("printing 3....");
    -----------------------the JSP page is called as test.jsp
    <%@page contentType="text/html" %>
    <%@page import="java.io.*" %>
    <%@page import="java.util.*" %>
    <%@page import="java.net.*" %>
    <%@page import="RunTest" %>
    <HTML>
    <TITLE>TESTING ANT GUI</TITLE>
    <HEAD>
    <META HTTP-EQUIV="Refresh" CONTENT="3000" >
    <meta http-equiv="Cache-Control" content="no-cache">
    </HEAD>
    <BODY BGCOLOR="silver" TEXT="333333">
    <table border=0>
    <tr align="left"><td align="left"><FONT SIZE="-1"><B>  Test Page <FONT SIZE="-1"><B></td></tr>
    </table>
    <hr></center>
    <form action="./test.jsp" method="POST" name="testForm">
    <table>
    <tr>
    <td>
    <select name="appName" size=1>
    <option value="">Select Application Name
    <option value="scsmail">scsMail
    <option value="clientmanager">ClientManager
    </select>
    </td>
    <td>
    <select name="boxName" size=1>
    <option value="">Select Box Name
    <option value="testnet">TestNet
    <option value="production">Production
    </select>
    </td>
    </table>
    <table>
    <input type="submit" name="deploy" value="deploy">
    <input type="submit" name="undeploy" value="undeploy">
    </table>
    <%
       RunTest rt = new RunTest();
       rt.applicationName(request.getParameter("appName"));
        String deployButton = "";
        deployButton=request.getParameter("deploy");
        String undeployButton = "";
        undeployButton=request.getParameter("undeploy");
        if(!deployButton.equalsIgnoreCase("")){
            rt.buttonClicked(request.getParameter("deployButton"));
        if(!undeployButton.equalsIgnoreCase("")){
            rt.buttonClicked(request.getParameter("undeployButton"));
       rt.boxName(request.getParameter("boxName"));
        rt.goTest();
    %>
    </form>
    </table>
    </BODY>
    </HTML>

  • Unable to import a java class in a jsp file

    Hi,
    I am trying to import a java class in my jsp.
    ------------------jsp---------------
    <jsp:useBean id="form" class="com.company.portlets.searchApps.object.SearchOBJ" scope="request" />
    <jsp:setProperty name="form" property="*" />
    <input type="TEXT" name="projectID" value='<%= form.getProjectID() %>'>
    When I run the above JSP, it says that class 'com.company.portlets.searchApps.object.SearchOBJ' cannot be found.
    Why?
    My project structure looks like this:
    Project
    +Application Sources
    ++com.company.portlets.searchApps.object
    +++SearchOBJ.java
    +Web Content
    ++htdocs
    +++searchappsportlet
    ++++SearchAppsPortletShowPage.jsp
    ++WEB-INF
    +++index.jsp
    +Resources
    ++SearchApps.deploy
    Please advice...thanks!

    The way that JDeveloper organized the files was like this:
    C:\jdev1012\jdev\mywork\WksSearchApps\Project\classes\com\company\portlets\searchAPPS\object\SearchOBJ.class
    I am assuming that JDeveloper puts the file where they are suppose to be...if not, how do I change that?
    thanks,
    hussain

  • How to import custom java jar/class into oracle to be used in java proc ?

    Hi
    I would like to know how to import custom java jar/class files into oracle to be used in java stored procedure.
    I am developing a oracle pl/sql procedure to call java program. The java program will be created as procedure and will be published.
    But, my question is that I do have a other external jar/class file that need to be imported into this java program.
    example
    raise_sal.java
    import java.util.*;
    import oracle.sql.*;
    <<reference other java programs >>
    import cmpmsgsvc.xxxx.* ;
    import cmpmsgsvc.yyyy.* ;
    import cmpmsgsvc.zzzz.* ;
    how do I import the cmpmsgsvc jar/class file into oracle so that I don't have any
    compilation errros on raise_sal.java program ??
    what are the steps to import/compile and validate to do this?
    thanks for your help in advance.
    Thanks
    rrb.

    Kuassi
    Problem is that, I have 6 jar files that are needed to be included in the main java program. And, there are more than 50+ classes, propertiers in those 6 jar files.
    It might be not good idea to have all those 50+ classes in the production database.
    Is there anyway that I keep all those 6 jar files in unix box (our's is oracle erp installation with oracle being installed on unix box) and just refer them in the main java program. I mean database will be loaded with main java program and it should able to refer other 6 jar files from unix.
    if we create a directory and keep all jar files in there and include that directory in classpath variable, does this works? or what is other method?
    Please let me know.
    Thanks

  • ADF : How to import a java class in jspx page

    Hi All,
    In jsp we have page directive to import a java class. Do we have anything similar to that in a jspx page?

    Hello,
    If you create a new jspx file in jdeveloper, the untitled file generated will be this:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=UTF-8" import="java.util.*"/>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>untitled1</title>
    </head>
    <body></body>
    </html>
    </jsp:root>
    You can see the page directive there!

  • To Unable to Import Customize Java classes in Report Builder 10g

    Hi,
    In Report Builder 10g , I am trying to load image from Remote server
    URL:"http://imagecache5.art.com/p/LRG/15/1544/1ABDD00Z/muhammad-ali-vs-sonny-liston.jpg"
    Steps did in Report Builder 10g
    1.In Report Builder Created a Formula column with
    Datatype : Character
    Read from File: Yes
    File Format: Image
    In Formula columns trying to Unable to Import Customize Java classes.
    To read methods from Java classes.
    Please help on this.
    Ranga

    Hello,
    To import the Java classes:
    Add your jar in the REPORTS_CLASSPATH
    Launch Reports Builder.
    Note:
    You must launch Reports Builder now so that the new REPORTS_CLASSPATH is used.
    Choose Program > Import Java Classes to display the Import Java Classes dialog box.
    Regards

  • Problem with importing a java export on SQLSERVER 2005

    We are trying to import a java export for a system refresh.   The SAPINSTgets too step 31 of 32, run java migration toolkit, and then fails  with the following error.
    invalid object name "J2EE_CONFIG"   This is showing up in the runJmt.log.
    com.sap.engine.frame.core.configuration.ConfigurationException: Error occurred during DB access: cluster_data/dispatcher,
         at com.sap.engine.core.configuration.impl.persistence.rdbms.PersistenceHandler.readConfig(PersistenceHandler.java:108)
         at com.sap.engine.core.configuration.impl.cache.CachedConfiguration.<init>(CachedConfiguration.java:62)
         at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.getCachedConfiguration(ConfigurationCache.java:848)
         at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.getCachedConfiguration(ConfigurationCache.java:882)
         at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.openConfiguration(ConfigurationCache.java:748)
         at com.sap.engine.core.configuration.impl.ConfigurationHandlerImpl.openConfiguration(ConfigurationHandlerImpl.java:734)
         at com.sap.engine.core.configuration.impl.ConfigurationHandlerImpl.openConfiguration(ConfigurationHandlerImpl.java:693)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl._getSourceIds0(ClusterDataImpl.java:54)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl.getDispatcherIds(ClusterDataImpl.java:91)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl.createIdMapping(ClusterDataImpl.java:172)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.prepareSwitch(MigrationToolImport.java:1129)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.startTool(MigrationToolImport.java:403)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.main(MigrationToolImport.java:1561)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:81)
    Caused by: java.sql.SQLException: [NWMss][SQLServer JDBC Driver][SQLServer]Invalid object name 'J2EE_CONFIG'.
         at com.sap.nwmss.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
         at com.sap.nwmss.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
         at com.sap.nwmss.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
         at com.sap.sql.jdbc.basic.BasicPreparedStatement.executeQuery(BasicPreparedStatement.java:97)
         at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:281)
         at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:248)
         at com.sap.engine.core.configuration.impl.persistence.rdbms.DBAccessDefault.getConfiguration(DBAccessDefault.java:578)
         at com.sap.engine.core.configuration.impl.persistence.rdbms.PersistenceHandler.readConfig(PersistenceHandler.java:102)
         ... 17 more
    com.sap.engine.frame.core.configuration.ConfigurationException: Error occurred during DB access: cluster_data/dispatcher,
         at com.sap.engine.core.configuration.impl.persistence.rdbms.PersistenceHandler.readConfig(PersistenceHandler.java:108)
         at com.sap.engine.core.configuration.impl.cache.CachedConfiguration.<init>(CachedConfiguration.java:62)
         at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.getCachedConfiguration(ConfigurationCache.java:848)
         at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.getCachedConfiguration(ConfigurationCache.java:882)
         at com.sap.engine.core.configuration.impl.cache.ConfigurationCache.openConfiguration(ConfigurationCache.java:748)
         at com.sap.engine.core.configuration.impl.ConfigurationHandlerImpl.openConfiguration(ConfigurationHandlerImpl.java:734)
         at com.sap.engine.core.configuration.impl.ConfigurationHandlerImpl.openConfiguration(ConfigurationHandlerImpl.java:693)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl._getSourceIds0(ClusterDataImpl.java:54)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl.getDispatcherIds(ClusterDataImpl.java:91)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl.createIdMapping(ClusterDataImpl.java:172)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.prepareSwitch(MigrationToolImport.java:1129)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.startTool(MigrationToolImport.java:403)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.main(MigrationToolImport.java:1561)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:81)
    Caused by: java.sql.SQLException: [NWMss][SQLServer JDBC Driver][SQLServer]Invalid object name 'J2EE_CONFIG'.
         at com.sap.nwmss.jdbc.base.BaseExceptions.createException(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseExceptions.getException(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
         at com.sap.nwmss.jdbc.sqlserver.SQLServerImplStatement.getNextResultType(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.commonTransitionToState(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.postImplExecute(Unknown Source)
         at com.sap.nwmss.jdbc.base.BasePreparedStatement.postImplExecute(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at com.sap.nwmss.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
         at com.sap.nwmss.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
         at com.sap.sql.jdbc.basic.BasicPreparedStatement.executeQuery(BasicPreparedStatement.java:97)
         at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:281)
         at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:248)
         at com.sap.engine.core.configuration.impl.persistence.rdbms.DBAccessDefault.getConfiguration(DBAccessDefault.java:578)
         at com.sap.engine.core.configuration.impl.persistence.rdbms.PersistenceHandler.readConfig(PersistenceHandler.java:102)
         ... 17 more
    Error executing Migration Tool Import
    java.lang.IllegalArgumentException
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl.createBoxNumberMapping(ClusterDataImpl.java:137)
         at com.sap.sdt.serviceframework630.impl.ClusterDataImpl.createIdMapping(ClusterDataImpl.java:172)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.prepareSwitch(MigrationToolImport.java:1129)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.startTool(MigrationToolImport.java:403)
         at com.sap.sdt.jmt.migrationtool.MigrationToolImport.main(MigrationToolImport.java:1561)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sap.engine.offline.OfflineToolStart.main(OfflineToolStart.java:81)

    Hi David,
    since I experiencing the same problem like you did, I'm interested what do you mean by "SQLSERVER script for system refreshes".
    I was searching around but didn't find anything close to this?!
    Can you please help?
    Tnx.
    Kind regrads,
    Samo

  • One disadvantage of automatic import of Java lang package.

    When ever a new java class is added in java.lang package jdk people has to think one think in their mind. I have written one java class named com.myPack.Test if suppose the same class name is included in java.lang then that greatly affects all my programs.since java.lang is by default imported. i have to do lot of changes in my code.
    Can this be avoided. Can i avoid the default import of java.lang package by any means.
    Am i making sense.?

    thanks jsalonen and pbrockway2
    I understand but, Isn't it a Genuine requirement..?
    I have written a class say com.myPack.Test
    i am using this in some other package.
    i am importing this by the below statement
    import com.myPack.*;
    this package is extensivly used in many a packages.
    suppose in new JDK if the java.lang.TEST is written.
    In this case, it is a gereat overhead for me. i have to do lot of code changes right?.
    one solution can be replace all import com.myPack.* by
    import com.myPack.Test; but isn't it a great rework. which afects widely in all the applications right?..
    one other simple solution can be avoiding default import java.lang.* in certain packages alone, Isn't it?

  • Java Importer: import of java.lang.Boolean does not compile?

    I have created a webservicestub for the Reports webservice with JDeveloper.
    Now I want to use it in Forms. All methods work correctly, except the runJob method, which uses a boolean argument. I think I need to import java.lang.Boolean for it, but the created package body does not compile ("wrong number or type of arguments" in jni calls).
    Does anybody have suggestions how to get it compiling, or how to call the runJob method without the import of java.lang.Boolean?

    Downloading 1.4 sdk does not have the javac, it just has the JRENo, you apparently downloaded the JRE runtime. Do this to get the compiler, etc:
    Go here: http://java.sun.com/j2se/1.4/download.html
    and in the section titled:
    Download J2SETM v 1.4.0_01 JRE SDK
    look in this row:
    Windows (all languages, including English)
    and click download in the column headed SDK at the far right

  • How to import a java class

    Hi
    I want to know how can i import some java classes to my application.
    I'm trying to write a little class as:
    package paco.view;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    public class ClobConverter implements Converter {
    public ClobConverter() {
    public Object getAsObject(FacesContext context,
    UIComponent component,
    String value) {
    if (context == null || component == null) {
    throw new NullPointerException("FacesContext and UIComponent can not be null");
    if (value == null) {
    return null;
    try {
    return new ClobDomain(value);
    } catch (Exception ex) {
    final String message =
    String.format("Unable to convert boolean value \"%s\" into a oracle.jbo.domain.Number",
    value);
    throw new ConverterException(message, ex);
    public String getAsString(FacesContext context,
    UIComponent component,
    Object value) {
    if (context == null || component == null) {
    throw new NullPointerException("FacesContext and UIComponent can not be null");
    return value.toString();
    but I'got this message:
    Error(3,8): class javax.faces.component.UIComponent not found
    Error(4,8): class javax.faces.context.FacesContext not found
    Error(5,8): class javax.faces.convert.Converter not found
    Error(6,8): class javax.faces.convert.ConverterException not found
    What should I do?
    Thanks in advance
    FRANCISCO

    You need to add the faces library to you project. To do this, select the project properties, go to libraries and class path and select the faces library.
    Using JDev you can also choose one or more project technologies (project properties->technology scope) which will add the needed libraries to the project.
    Timo

  • Import net.java.stun4j.StunAddress; anybody knows how i can get this jar fi

    Can anybody tell me how i can get this
    import net.java.stun4j.StunAddress;
    i need these jar files.

    Previous link was on older version, it did not help me. Finally I've got latest version in source from CVS

  • Imports (importing other java files)

    Hi there. this is sorta urgent.
    It works at uni, but not here, don't know why.
    I am using JDK 1.4.1_01 and jcreater lite as an IDE
    I have made a program, its for the course, but everytime I compile it says that the packages could not be found.
    for example:
    import Date.java;
    import Calander.java;
    public class mainapplication {
         public static void main(String[] args)
    ..It gives me an error:
    C:\coursework2\mainapplication.java:16: package Date does not exist
    import Date.java;
    ^
    C:\coursework2\mainapplication.java:17: package Calander does not exist
    import Calander.java;
    ^
    C:\coursework2\Date.java:15: package Calander does not exist
    import Calander.java;
    ^
    3 errors
    And if I take out the .java; from the imports commands, then it still won't compile, saying it's expecting a '.'!
    What should I do? I even tried going into MSDOS and typing javac mainapplication.java but i still get the same errors
    Please help, I know it's a simple solution, but need your help.
    Thanks

    It works at uni, but not here, don't know why.
    It does not work at uni, if you don't believe me go test it.
    The "import" statement only gives you the option to use short names for classes. Thanks to it you don't need to type the fully qualified class name, such as "javax.security.auth.kerberos.KerberosKey", every time you want to use the class ("KerberosKey"). It only exists to help you, the programmer, write shorter code and type less.
    That said, you cannot "import java files". It just makes no sense.
    Date and Calendar are both in the package java.util, maybe you want to "import java.util.Date" and "import java.util.Calendar".
    Hi there. this is sorta urgent.
    I hate people who use that word...

  • Import tablesorter.java

    Hello,
    i'm a newbie and it is highly probable that it is easy for you. I will import some *.java-Files, but how can i do that?
    Thanks,
    Peter

    hi peter,
    Go through this
    /people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60d5b593-ba83-2910-28a9-a7a7c7f5996f
    Thanks&Regards
    SureshKumar T

  • Error while adding condition Imports PO

    Dear Sir,
    We want add Freight charges and Custom Clearing Charges in Imports PO as Misc. Charges in condition ZMIS.
    But we try to add these as 3 % it gives following error
    Provision account key missing for condition type ZMIS in schema ZHILI1
    Message no. ME172
    Please suggest me the solution.
    Thanks & Regards
    Vishal

    Hi Vishal,
    the message ME172 was implemented because the system can not
    enter the delivery cost into an account without account key. Now the
    message occurs for PO's created in  older releases(schema without
    account key for condition ). It will also occurs if it is a statistical
    condition and in new POs.
    You can schwitch this message into an Warning message until the old
    POエs are 'finished'.
    You can change it using transaction OME0.The menu path in IMG is
    Materia ls Management ->Purchasing ->Environment Data ->Define Attribute
    Of System  Messages.You can either change it to a warning message "W"
    or switch it off by making an entry"-".
    Thanks and regards,
    Polly

  • Import in java

    Hi everyone,
    Could anyone have a clue on this?
    Is there anyway that all the "IMPORT" in many *.java files being placed in a separate (let say a parameter file where i could declare) file of my package, thus for example 2 classes importing JFrame and doing 2 different things having reference to only one import.... (i hope, i am explicit enough :-P ). I am using the 1.4 jre...
    thanks and god bless...

    ^not necessarily. For example, I have one class
    where I import java.net, .io, javax.swing, .awt, and
    .util. Of course because I only needed HashMap from
    util and ServerSocket from .net, I specifically
    imported only those 2 classes.....Are you directing that at my comments? What point are you trying to make here?
    Importing will take maybe 1/10th of a second,Probably less than that, and whatever effecft it has will be ONLY at compile time. It has ZERO runtime effect
    so
    import all you want. Don't be careless (importing
    libs you don't need) but don't worry about runtime.Yes, of course. Import what you need, and don't import what you don't. And no matter what you import, it will have ZERO runtime effect.
    But if you find that your class needs to use a large number of other classes, it's a good sign that your class is trying to do too much and should be refactored. There's no hard and fast rule. It's just a guideline, a warning sign.

Maybe you are looking for

  • Removing a device from my apple id account

    I have an apple id accont with multiple devices including my son's iPod touch.  I would like to remove his iPod touch and create a new apple id account for him so it's completely seperate from mine.  I would also like to do this without deleting ever

  • Heap Memory Issue in weblogic 9.2 for a JSF 1.1 web application

    Hi, We are running a JSF application (Myfaces, facelets, tomahawk, richfaces & iBATIS) in weblogic 9.2 server on Solaris 10. This application is deployed in production and works fine under normal circumstances. But when there is a heavy user load we

  • Why does my 27" iMac running OS 10.6.8 hang on the grey screen at start up?

    My 27" iMac, running OS 10.6.8, has started running slowly when loading Apps and when running Safari. Also, when powered, on It has started stopping on the grey screen before the Apple logo displays. To get past this I must turn the Mac off and then

  • BDC and SHDB

    Can any body give the  steps performed in BDC and SHDB clearly ? Thanks in advance. KP

  • Conversion Server Specification

    We intend to use SEAL solutions for file conversion into RH. We understand we would need a conversion server for this. But not sure what configuration/specification this conversion server should possess. Any info on this?? Regards Srikanth