Variable within an import statement

I'm wanting to have a variable in an import statement for different versions of a class
example - import someclass.VERSION.*;
but I want VERSION to be a variable that I can modify for every project that uses the class I'm importing from. I have not found any examples that have done this thus far.

The point of my suggestion was that it would make it unnecessary to change anything at all for compiling different versions.
make 3
Making version 3.0 <<<See how easy that can be? Reading the version of the class to load from an external class file and dynamically loading it is tantamount to a Rube Goldberg machine. Also, you still have to change a file, your properties file. If your project grows to any significant size, this approach will cause you serious headaches.

Similar Messages

  • How do I use a variable within a sql statement

    I am trying to use a local variable within an open SQL step but I keep getting an error.
    My sql command looks like this "SELECT BoardDetailID FROM BoardDetails WHERE SerialNumber = " +  locals.CurrentSerialNo
    If I replace the locals.CurrentSerialNo with an actual value such as below the statement works fine.
    "SELECT BoardDetailID FROM BoardDetails WHERE SerialNumber = " +  " 'ABC001' " 
    Can someone tell me how to correctly format the statement to use a variable?

    Hi,
    Thanks for the reply. I have changed the required variable to a string, but with no success. I have reattached my updated sequence file and an image of the error.
    When looking at the Data operation step I see that the sql statement is missing everything after the last quotation mark.
    Thanks again,
    Stuart
    Attachments:
    Database Test Sequence.seq ‏10 KB
    TestStand error.JPG ‏37 KB

  • Public/Global variable within an If statement..

    Is there way to declare a variable as Public in an IF statement. My goal is to declare the variable as global (since this variable is used somewhere in the code and should not get initialized when there is loop back to the top of the code, hence using IF statement to control the initialization) based on the IF condition and then use it elsewhere in the code.
    I have it like this
    if (!sei_second_jsp.equals("1"))
    public int[] mecitem;
    public String[] sei_mfg_prod_cat;
    public String[] sei_part_number;
    public String[] sei_descrip;
    public String[] sei_price;
    public int[] sei_onhand;
    public int[] sei_demand;
    mecitem = new int[20000];
    sei_mfg_prod_cat = new String[20000];
    sei_part_number = new String[20000];
    sei_descrip = new String[20000];
    sei_price = new String[20000];
    sei_onhand = new int[20000];
    sei_demand = new int[20000];
    for (int i=0; i<=19999; i++)
    mecitem[i] = 0;
    sei_mfg_prod_cat[i] = " ";
    sei_part_number[i] = " ";
    sei_descrip[i] = " ";
    sei_price[i] = " ";
    sei_onhand[i] = 0;
    sei_demand[i] = 0;
    Your guess is right, I am using this code in JSP - since this is a Java related question, thought of posting it in JAVA forum.
    When I use the above code, I get the following error
    1809 }' expected. { 
    1811 Statement expected. public int[] mecitem;
    1827 Identifier expected. mecitem = new int[20000];
    1827 Can't specify array dimension in a declaration. mecitem = new int[20000];
    1827 Identifier expected. mecitem = new int[20000];
    1837 Can't specify array dimension in a declaration. sei_onhand = new int[20000];
    1837 Identifier expected. sei_onhand = new int[20000];
    1839 Can't specify array dimension in a declaration. sei_demand = new int[20000];
    1839 Identifier expected. sei_demand = new int[20000];
    3117 Class or interface declaration expected. }
    I will post the same in JSP forum as well.. thnks a lot

    1809 }' expected. { I would guess that you have a syntax error above this error. The other errors are caused by that.

  • Setting a Stored Procedure Variable within a CASE Statement

    I am attempting to build a Merge/Purge Key of our Members and am trying to use this syntax...
    /* The First Part of the Merge/Purge Key is built on the first 4 consonants of [member].[NAME_LAST] */
    SELECT
    CASE
    WHEN SUBSTRING([@NameLast],@Counter,1) <> 'A'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'E'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'I'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'O'
    AND SUBSTRING([@NameLast],@Counter,1) <> 'U'
    THEN CASE
    WHEN @Counter = 1
    THEN @MergePurgeKeyLastNamePos1 = SUBSTRING([@NameLast],@Counter,1)
    I cannot seem to set my Storage Variable @MergePurgeKeyLastNamePos1 with the non-consonant value that it finds.
    Do I need to over simplify this first by setting some CHAR(1) Storage Variable and then building the 4-character Merge/Purge Key of Last Name?
    Thanks for your review and am hopeful for a reply?

    >THEN @MergePurgeKeyLastNamePos1
    =SUBSTRING([@NameLast],@Counter,1)
    Assignment cannot be done in a case THEN. Only a scalar value can be returned.
    You can do assignment like SELECT @variable = CASE.....
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Using a var within an Include statement

    What syntax do I use in order to put a variable within an Include statement...
    <%@ include file="<%= varhere %>.htm" %>
    Thanks for any help!

    use
    <include>
    <param name=" something " value="34"/>
    </include>

  • Import statement: pass parameter or variable in import statement ??

    Hi All..
    Is there a way to pass parameter or a variable to a url in the import statement..
    I'll be using a url in the import statement, the url will be having a dynamic .rtf file...something like
    <?import:http://#server#:#port#/xmlpserver/<mySubTemplate>.rtf?>
    where <mySubTemplate> is dynamic..
    I've been searching this thread for a while now and ended up close...
    Import sub template dynamically
    Thanks in Advance..

    Have you tried replacing the mySubtemplate.rtf part with a variable, or replace the entire URL using a variable? Try using the same construct from this example in the Report Designer's guide (page 7-14, 10.1.3.4).
    In Microsoft Word's Format Picture dialog box select the Web tab. Enter the
    following syntax in the Alternative text region to reference the image URL:
    url:{IMAGE_LOCATION}
    where IMAGE_LOCATION is an element from your XML file that holds the full
    URL to the image.
    You can also build a URL based on multiple elements at runtime. Just use the
    concat function to build the URL string. For example:
    url:{concat(SERVER,'/',IMAGE_DIR,'/',IMAGE_FILE)}
    where SERVER, IMAGE_DIR, and IMAGE_FILE are element names from your XML
    file that hold the values to construct the URL.
    This method can also be used with the OA_MEDIA reference as follows:
    url:{concat('${OA_MEDIA}','/',IMAGE_FILE)}

  • How can i append the variable to filename in import statement?

    how can i append variable(substitution variable) to file name in import command for maxL?
    example : For suppose there is a file like "dataload.txt" and a variable like cur_month(august).How can i rename the file like daload_august in import statement.
    Edited by: 788996 on Aug 22, 2010 11:18 PM

    Are you saying you want to use an OS level environment variable in a MaxL statement to substitute for an entire file name? I am going to illustrate Windows, but do it your own way in *nix if you want.
    YourCallingCode.cmd
    REM Note the \\ and then the \\, you had \\ and \
    SET curmon=c:\\ABC\\datafile_21_AUG.txt 
    REM Call MaxL with a paramenter
    startMaxL.cmd DoItForTheCurrentMonth.msh %curmon%DoItForTheCurrentMonth.msh
    login blah blah for blah ;
    import database appname.dbname data from local text data_file $curmon using server rules_file "rulefile"
         on error abort ;The trick is to change whatever's in % and % and replace it with a $ in the MaxL script.
    I gave a presentation last year on MaxL at ODTUG Kaleidoscope. If you go to http://www.odtug.com, then Tech Resources, then Essbase, then search on my name, you'll find "Master Essbase with MaxL Automation". More than you could ever want to know about MaxL, variables (parameter, environment, and explicitly declared), scripting, etc., etc., are all there for the taking. If you're not already a member, you'll have to join, but an associate membership is free. You can then download my presentation and all of the others. It is a treasure chest of technical tips and knowledge.
    Yes, I am a fan a member of the Hyperion SIG, so I am ever so slightly biased. Regardless, it is good information, for free.
    Regards,
    Cameron Lackpour
    Edited by: CL on Aug 24, 2010 5:33 AM
    If you want to substitute part of the data file name, you can do that too:
    set curmon=21_AUG
    Your MaxL statement would look like:
    import database appname.dbname data from local text data_file "c:\\ABC\\datafile_$curmon.txt" using server rules_file "rulefile"
         on error abort ;

  • Dynamic parameter with an IMPORT statement

    Hello experts. I hope you can help me with this issue:
    I have a report performing an EXPORT statement into a Buffer:
      EXPORT I_USER    FROM P_USER
                    I_NAME    FROM P_NAME
                    I_SURNAME FROM P_SURNAM
               TO DATA BUFFER V_XPARVALUES.
    Then it calls the first FM where a type I program is created by using INSERT REPORT... This dynamic-generate INCLUDE has the explicits declaration for variables: I_USER, I_NAME, I_SURNAME.
    Afeter the dynamic Include generation, it calls a second FM, wich has the reference to the dynamic Include created before with the data declaration. The only thing remain is to IMPORT all the data from the buffer V_XPARVALUES:
    The following code lines are within a LOOP. wa_param-paramname has the name of the variable (I_USER, I_NAME I_SURNAME).
        ASSIGN (wa_param-paramname) TO
          FROM DATA BUFFER v_xparvalues.
    but what I need to achieve is dynamic parameters in the IMPORT statement.
    Had anybody came across this problem?
    I hope I have been clear with the explanation.
    Regards,
    Andrés Sarcevic.

    IMPORT/EXPORT scope didn't work out. Instead, I used CALL TRANSFORMATION and XML approach, besides some ABAP creativity.

  • Problems with IMPORT STATEMENT

    Please, can someone assist me? I am using Java Studio Enterprise 8.1 & Netbeans to design a java application and input form. But the wizard keeps on generating repeated class and subclasses even after I have used the import statement. Its making my program looks clumsy.
    I just want to use import statement once and start using the variable in the program without repeating the declaration.
    For instance, after importing javax.swing.*, I just want to be able to specify in my program (e.g JPanel Coylogo) without the wizard generating another private javax.swing.JPanel Coylogo.
    How can I do it. Please help. I will appreciate
    You look at the following section of the program to unstand what I mean. Thank you.
    import java.awt.HeadlessException;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.sql.*;
    import java.text.ParseException;
    import java.text.SimpleDateFormat;
    import javax.swing.*;
    import java.sql.Date;
    * @author */
    public class inputForm extends JFrame
    private Connection con;
    private Statement stmt;
    private int k;
    ResultSet rs=null;
    // Variables declaration - do not modify
    private javax.swing.JLabel ClassLabel;
    private javax.swing.JPanel Connectivitypanel;
    private javax.swing.JPanel Coylogo;
    private javax.swing.JCheckBox DataCapable;
    private javax.swing.JLabel DateLabel;
    // End of variables declaration
    * Creates new form inputForm
    public inputForm()
    //con = new dbConnect();
    initComponents();
    con = dbconnection();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents()
    Coylogo = new javax.swing.JPanel();
    PhoneType = new javax.swing.JPanel();
    PhoneIdLabel = new javax.swing.JLabel();
    ClassLabel = new javax.swing.JLabel();
    phoneid = new javax.swing.JTextField();
    DateLabel = new javax.swing.JLabel();
    Connectivitypanel.setBorder(javax.swing.BorderFactory.createTitledBorder("CONNECTIVITY"));
    pbluetooth.setText("Bluetooth");
    pbluetooth.setActionCommand("bluetooth");
    pbluetooth.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
    pbluetooth.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
    pbluetooth.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
    pbluetooth.setMargin(new java.awt.Insets(0, 0, 0, 0));
    }// </editor-fold>
    private void allPhonesTypeActionPerformed(java.awt.event.ActionEvent evt)
    }

    disable add imports or organize imports in your IDE

  • Import statement and directory structure

    First of all, sorry for such a long post, I believe part of it is because I am unsure of the concept of importing in Java. Secondly, Thanks to anyone who can ultimately enlighten me to the concept of import. I did ask this question before in the "erorr and error handling" forum, and the people who have helped me there did a great job. But, I believe I require a little more clarification and thus have decided to post here.
    Anyhow, my question..
    Could someone explain to me the concept of the import statement, or direct me to a webpage with sort of explanation for newbies? For some reason, I am having a hard time grasping the concept.
    As I understand it, the import statement in Java, is very similar to the namespace keyword in C. That is to say, import doesn't actually "import" any source code, the way that the #include statement does in C.
    So I suppose what my question is, say I have a java class file like below:
    //filename: sentence.java
    //located: c:\school\csc365
    package csc365;
    class sentence
    //some variables here..
    //some constructor here..
    //some methods here..
    And some sample program like the one below which implements the above..
    //filename: test.java
    //located: c:\school\csc365
    import csc365.*;
    import java.io.*;
    class test.java
    //creates some sentence object
    //uses the object's methods
    //some other things.
    As I understand it, the test.java file should not compile because the csc365 package is not in the correct directory. (assuming of course, the classpath is like c:\school\csc365;c:\school )
    But, ... where then should the sentence.java be located? In a subdirectory of c:\school called csc365 (i.e c:\school\csc365\) ?
    And thus that would mean the test.java file could be located anywhere on the hard drive?
    I suppose, I just need a little clarification on the correlation between a package's "name" (i.e package csc365; ) and its corresponding directory's name, and also how the javac compiler searches the classpath for java classes.
    ..So, theoretically if I were to set the classpath to look in every conceivable directory(provided the directory names were all unique) of the harddrive, then I could compile a test.java anywhere?
    As a note: I have been able to get the test.java file to compile, by leaving out the import statement in the test.java file, and also leaving out the package statement for the sentence class, but I assume this is because the files are defaulted to the same package?

    Hi Mary,
    No, import isn't analogous to C++ namespace - Java package is closer to the namespace mark.
    import is just a convenience for the programmer. You can go your whole Java career without ever writing an import statement if you wish. All that means is that you'll have to type out the fully-resolved class name every time you want to use a class that's in a package other than java.lang. Example:
    // NOTE: No import statements
    public class Family
       // NOTE: fully-resolved class names
       private java.util.List children = new java.util.ArrayList();
    }If you use the import statement, you can save yourself from typing:
    import java.util.ArrayList;
    import java.util.List;
    public class Family
       // NOTE: fully-resolved class names
       private List children = new ArrayList();
    }import isn't the same as class loader. It does not bring in any source code at all.
    import comes into play when you're compiling or running your code. Java will check to make sure that any "shorthand" class names you give it live in one of the packages you've imported. If it can't find a matching fully-resolved class name, it'll give you a message like "Symbol not found" or something like that.
    I arrange Java source in a directory structure that matches the package structure in the .class files.
    If I've got a Java source file like this:
    package foo.bar;
    public class Baz
       public static void main(String [] args)
            Baz baz = new Baz();
            System.out.println(baz);
       public String toString()
           return "I am a Baz";
    }I'll store it in a directory structure like this:
    root
    +---classes
    +---src
          +---foo
               +---bar
                    +---Baz.javaWhen I compile, I go to root and compile by typing this:
    javac -d classes foo/bar/*.javaI can run the code from root by typing:
    java -classpath classes foo.bar.BazI hope this wasn't patronizing or beneath you. I don't mean to be insulting. - MOD

  • Import statement in .java files and .jsp files

    Guys I have few mysteries about this import statement.
    Please correct me if I am wrong.
    1)Suppose if I have a folder c:\SourceFolder it has one.java and two.java files.If I compile one.java then one.class files is created in c:\ClassFolder .Now two.java uses one of the method of one.java,and without using import statement I am able to compile two.java, and two.class file is created in c:\ClassFolder.I assume that the path of one.class was taken from the CLASSPATH environment variable,hence I there was no need for import statement .........am i right ?
    BUT... in My.jsp,which is in C:\JspFolder, if I want to use one.class,then I have to specifically import the class I want to use.That is i have to say
    <%@page import="one"%>
    and since the classpath is C:\ClassFolder ,it finds one.class in the C:\ClassFolder.(Note that My.class is created in a folder different from c:\ClassFolder )
    But I am wondering why was there no need for me to import one.class in two.java.
    (Note I am using JDeveloper and Apache server)
    Please help.
    In this case the pSo I am wondering in JSP why it doesn't take the class I am looking for from the classpath .
    Help.

    You have to understand Java scoping rules. In the 1st scenario with the two Java files I am guessing neither one of them begins with a package statement. This means that they belong to the default package. When you compile the compiler uses the classpath to resolve method calls looking in the default package since there was no import statement specified in two.java. JSP is a little different. Now I just read this here in these forums a couple of days ago. Since the classfiles generated from the JSP files are not in the CLASSPATH they are loaded by a different classloader. This is why you have to import all references to all classes in the default package.

  • Import statement in .java files and .jsp files ..correction

    Guys I have few mysteries about this import statement.
    Please correct me if I am wrong.
    1)Suppose if I have a folder c:\SourceFolder it has one.java and two.java files.If I compile one.java then one.class files is created in c:\ClassFolder .Now two.java uses one of the method of one.java,and without using import statement in two.java I am able to compile two.java, and two.class file is created in c:\ClassFolder.I assume that the path of one.class was taken from the CLASSPATH environment variable,hence I there was no need for import statement .........am i right ?
    BUT... in My.jsp,which is in C:\JspFolder, if I want to use one.class,then I have to specifically import one.class in My.jsp .That is i have to say
    <%@page import="one"%>
    in My.jsp.
    and since the classpath is C:\ClassFolder ,it finds one.class in the C:\ClassFolder and MyJsp is compiled sucessfully.(Note that My.class is created in a folder different from c:\ClassFolder )
    But I am wondering why was there no need for me to import one.class in two.java.
    (Note I am using JDeveloper and Apache server)
    Please help.

    It has to do with packages. Most java classes are in a package, the name of which must conform to its place on the filesystem relative to the classpath. By that I mean that if you have com.mystuff.One.java, it must be in a folder com/mystuff where com is located somewhere in the classpath.
    What you've done is a little different. I'm assuming a couple of things:
    1. you have no package declaration at the top of one.java or two.java
    2. you have the current directory "." in your classpath.
    Java has the concept of the "default package", which covers classes without a declared package, and in your case is the current directory.
    So when you're in c:\sourcefolder and run the compiler, then "."="c:\sourcefolder", and that directory is part of the default package. No import statements are necessary for classes that are in the same package. This is why two.java can call methods in one.java without an import statement.
    When you run your jsp, the "current directory" part of your classpath is not c:\sourcefolder, but some other value (probably the directory you start your jsp engine from) You will have to import all non-java-library classes because the jsp itself becomes a java class, with a package that is determined by the jsp engine.

  • Length error occurred in IMPORT statement.

    Hi All,
               while exexuting a program i got dump saying that Length error occurred in IMPORT statement. through ST22 i came to know that both import and export structres are not same. Import structure is longer than the export structure.
             I tried in SDN but i coudnt find any solution. can you please suggest how to solve this.
    Thanks in advance,
    Sreekala.

    Hi,
    Maybe what you can do si....
    Program X
    data: v_var(20) type c.
    export v_var.
    Program Y
    data: v_var(20) type c,
             v_var2(50) type c.
    import v_var.
    v_var2 = v_var.
    Create a variable that is exactly the same with the exporting parameter, then just assign it to a local variable declared in the 2nd program.
    Hope this helps.
    Benedict

  • Import statement giving error

    Hi All,
    I am writing a JSP page, and need to instantiate an object of a certain class within my package, in my JSP page.
    How do I do that? Do i use the <%import = "Myclass.class" %>
    I am using Sun Forte.. and the directory is myprojects/test/Classes/MyClass.java
    so how would the import statement look like?
    Thanks
    Kal.

    Kal,
    You would use the page directive with the import attribute. It looks like this: <%@page import="MyPackage.MyClass"%> or if your class is in the default package <%@page import="MyClass"%>. It is suggested that all classes used in JSP be packaged. (That is they include the package statement in thier source file and reside in a directory structure resembling the package name.)
    Cliff

  • Usage of import statements

    I have a problem of using packages & import statements....
    Something like this...
    Assume,
    i have 2 java classes. (Class1.java & Class2.java)
    Class1.java is in --> C:\java\examples\folder1\abc\Class1.java
    Class2.java is in --> C:\java\examples\folder2\xyz\Class2.java
    I need to access a variable in Class1.java from Class2.java
    In that case, how can i use import statement???
    "Class1.java" looks like this-->
         package abc;
         public class Class1{
            public static int value = 10;
            public static void main(String args[]){
              System.out.println("This is class1");
    "Class2.java" looks like this-->
              package xyz;
         import *************************;
         public class Class2{
            public static void main(String args[]){
              System.out.println("This is class2");
              System.out.println("Class1 value is"+Class1.value);
         }In Class2.java - what should be the import statement???
    (Is it import abc; OR any other)
    Do i need to set the classpath to both the packages seperately???
    To the C:\java\examples\folder1\abc AND C:\java\examples\folder1\xyz
    If the above is incorrect, to which folder should i set the classpath?
    Pls help!

    The import statement should be:import abc.Class1;orimport abc.*; // not recommend because of potential name clashesYour classpath should contain both C:\java\examples\folder1 and C:\java\examples\folder2 (that is: any folders containing the top of a package hierarchy).javac -cp C:\java\examples\folder1;C:\java\examples\folder2 <javasourcefiles>

Maybe you are looking for

  • Search results in iCal give wrong dates

    Hi there, I have a very odd problem with iCal: whenever I search my calendearr all the results have a date in January 2007. When I click one of the results, it does go back to the right date in the calendar. The problem reoccurs when I use TimeLog 4:

  • Nokia Quality Control

    Hello I bought Nokia 6120 Classic 2 days ago. I like it very much. It's fast, small with good display! BUT I'm very disappointed! It seems this phone has hardware problem - a lot of colored vertical lines appears on the display if it's in idle mode f

  • Downloaded PDF file on front end is not opening

    Hi, We have a requirement to open the Master Data Governance documents (which are stored as RAWSTRING in a DB table) from an ALV on double click. We are downloading the binary content(converting XSTRING to BINARY) as a file with appropriate extension

  • To buy or not to buy....

    After my pc died I purchased a mac. I need to use photoshop for work but cannot afford the over £800 price tag as I am just a freelance one man band(I did elements trial but its no good for me) I have several questions. One is that I have seen what a

  • I just want to cancel my subscription please!!!

    I want to cancel my acrobat pro dc subscription please. that is all I want to do