Import my own package??!!!

hello guys,
I'm having a litle difficulties importing my own package.
here is my example:
I have a folder on C:\Users\User\Desktop\test2 in wich u can find a file called "hello.java" and another folder called "hi" which contains a file "hello2.java"
in the file hello.java i want to create an instance of "hello2" so it is clear that i have to import from hello.java the package containing hello.class
SO WHAT I DID IS THE FOLLOWING:
first in enviroment variable i added to my CLASSPATH the path C:\Users\User\Desktop and in the file " hello.java" i wrote at the top:Import test2.hi.hello2
it is still not working.
i read somewhere that my package should have the following form: fr.inria.itey which i did not understand.
can u plz give from my example what is my package name? and finally how to solve the issue
thank you in advance for your help

Hi ralfph.
I suggest using an IDE such as eclipse. It has an auto complete utility that allows autogeneration of import code which is guaranteed to be correct.
Based on your post, I'm not sure if it is a typo but you mentioned you wrote at the top "Import test2.hi.hello2".
I would like to know if you got a compile error as "Import" should be typed as import with a small i.

Similar Messages

  • Make and import my own package

    i create a class named Example in a package named test..after i compile Example.java with my IDE a C:/myfolder/test direcotry is created...
    now i have a class named Nothing in the following directory:
    C:/Documents and Settings/myclasses
    i want to import the test package in my Nothing class..how does the import command should be?? thanks...

    well there are differnt ways to do what you want...
    one way i use is assume Example is your class package
    all you do is you add that package into whichever
    project your currently working on them import it like
    post #1That method is not very practical when you have a
    large library of class files that you don't want to
    copy and paste into every single project that you
    need to use to them for.
    That's why learning about the classpath, as suggested
    in replies #4 and #7, is very beneficial.The method of adding the package to your project is the IDE's way of determining the classpath. But, this hides the idea of classpath from the coder. This is why it is recommended that beginners don't use IDEs--it hides valuable concepts from the coder, who then doesn't know what to do when they have a problem when they have to use just the JDK or a different IDE.

  • How to import my own package in my jsp?

    I am doing aproject now. I have finished the java source file and complied them successfully. I want to package all of them and import this package in my jsp files. I copy all the .java and .class files to tomcat/webapps/projsp/WEB-INF/classes/ directory. I also write one line in my jsp file as following:
    <%@ page language= "java" import="java.sql.*,java.util.*,java.io.*,induction.*" %>
    My package named induction. I guess the problem is abput the class path. I don't know how can system find the package of mine. Hopefully, someone can help me!
    Below is The error information when I run my jsp:
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
    /usr/local/tomcat/work/DEFAULT/projsp/jsp/geography_1.java:9: Package induction not found in import.
    import induction.*;
    ^
    1 error, 1 warning
    at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
    at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
    at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
    at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
    at java.lang.Thread.run(Thread.java:536)

    Hi!
    Yes! You should create induction subdirectory in classes or
    archive induction subdirectory in a jar file and store it in lib
    subdirectory.
    Bye

  • Rookie trying to make my own package

    Reading in a real good book - "Thinking in Java" by Bruce Eckel. Really helping me to understand better a lot of the stuff that I had in my Java course at school.
    Got to a section where he's showing how to make your own packages. I'll lift directly:
    Consider, for
    example, creating an alias for System.out.println(�) to reduce
    typing. This can be part of a package called tools:
    //P.java
    // The P.rint & P.rintln shorthand.
    package com.bruceeckel.tools;
    public class P {
    public static void rint(String s) {
    System.out.print(s);
    public static void rintln(String s) {
    System.out.println(s);
    You can use this shorthand to print a
    String either with a newline (P.rintln(�)) or without a
    newline (P.rint(�)).
    So, I cut and pasted right into the text editor I use to practice with, saved and compiled it in a subdirectory off of one of the directories in the CLASSPATH, followed with a little test program:
    //ToolTest.java
    import com.bruceeckel.tools.*;
    public class ToolTest {
    public static void main(String[] args) {
    P.rintln("Available from now on!");
    P.rintln("" + 100); // Force it to be a String
    P.rintln("" + 100L);
    P.rintln("" + 3.14159);
    Here's the result of the compile:
    C:\Thinking in Java\com\bruceeckel\tools>javac ToolTest.java
    ToolTest.java:3: Package com.bruceeckel.tools not found in import.
    import com.bruceeckel.tools.*;
    ^
    1 error
    C:\Thinking in Java\com\bruceeckel\tools>
    At first I tried doing it on my own, making up my own package name, creating my own little source files, but got the same error. So I cut and pasted directly from the book, thinking surely it would work if I used Eckel's own code. Nope.
    Any clue what's going wrong? I've checked the CLASSPATH carefully, it includes
    C:\Thinki~1
    Thanks
    Felecha

    Your classpath should include "C:\Thinking in Java", not C:\Thinki~1.
    Also, your ToolTest.java should be in some other folder than "C:\Thinking in Java\com\bruceeckel\tools" - javac may act weird when it can find the to-be-imported classes in both the current folder and the classpath.
    If ToolTest.java had been in the folder "C:\Thinking in Java" you wouldn't have needed to modify the classpath.

  • HELP: Import my own class in JSP ???

    Hi, all!
    I read many previous topics in this forum but no one works for me!
    Please someone help me!
    I'm using Tomcat 4.1.12 and my JSP scripts work just fine, but I need to import my own .class file. I just don't know where to put it so Tomcat can find it!?
    I have this environment variable:
    JAVA_HOME=.;c:\jdk1.3.1
    And in my code I'want to place something like this:
    <%@ page import="myClass" %>
    But I get a "can not resolve symbol" exception.
    Thanks for readind this, and please help if you can!
    Bye.
    adriano

    Within the Tomcat directory, under your application directory place the class file/s into the WEB-INF/classes directory. If your classes are part of a package place the entire directory structure of the package under the WEB-INF/classes directory.
    The import in the JSP is the same as for any Java class.
    Hope this solves your problem.

  • Trying to create my own package

    So basically, I am trying to create my own package in WIndows.
    I have created the directory:
    C:\javaclasses\defnull\array
    and in that directory all I have is:
    intcheck.class
    All the class does is check how large an integer array is. Here is the uncompiled code:
    package defnull.array;
    public class intcheck {
         public static int inarray(int[] numbers){
              int i = 0;
              try {
                   for (i = 0; true; i++)
                        numbers[i] = numbers;
              catch (ArrayIndexOutOfBoundsException e){
                   return i;
    I opened up the cpanel, went to system, Advanced, Environment Variables, and added:
    ;C:\javaclasses
    onto the end of the classpath variable.
    Now, here is where I run into issues:
    Problem a:
    If I import the just the intcheck class, the program works fine:
    import defnull.array.intcheck; //  IMPORTING ONLY THE INTCHECK CLASS.
    public class tester {
         public static void main(String[] args){
    int[] hai = new int[18];
    int x = intcheck.inarray(hai);
    System.out.println(x);
    }and the output is "18".
    But if I try to import the entire folder "array" of classes, like this:
    import defnull.array.*; // IMPORTING ENTIRE FOLDER OF CLASSES
    public class tester {
         public static void main(String[] args){
    int[] hai = new int[18];
    int x = intcheck.inarray(hai);
    System.out.println(x);
    }I get these errors
    .\intcheck.java:3: class tester is public, should be declared in a file named tester.java
    public class tester {
           ^
    tester.java:9: cannot access intcheck
    bad class file: .\intcheck.java
    file does not contain class intcheck
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    int x = intcheck.inarray(hai);
            ^
    2 errorsIt should just be importing the whole folder of classes, correct?
    I have even tried to create a new object for it:
    intcheck check = new intcheck();It just gives similar errors

    I dont understand why:
    import defnull.array.intcheck;
    would work but not:
    import defnull.array.*;
    It seems to be that specific class that is not working. i made another simple one to print out a string, which allowed me to use the wildcard.
    what is wrong with that class?

  • Builtin package VS own package

    I have created one own AWT package.In my own AWT package cotains methods are same as in built-in AWT package. I am importing built-in awt package also. I am accessing one method .. which package will execute ??? will it execute my own package or buitl-in package??
    Pl. answer the above question.
    Regards & thanks,
    srinivas

    I assume you are talking about classes rather than methods. There's no problem with methods with the same name etc. if they are in different classes.
    It's not a good idea to have more than one version of the same class (including package name) available but, if you do, which one you get depends on the order of items in your classpath.
    You should not be creating your own classes with package names starting with java anyway. If you want to create your own awt use your own package name, then there's no ambiguity.

  • Purpose of Update/Overwrite Hierarchy in Import master data package

    Hi All,
    Please let me know what is the difference in update and overwrite option in import master data package. Here when i tried running the package, both the option are altering the hierarchy of existing member.
    My requirement is just to add a new member ID, if it already exist it should not affect those records and only update the new master data records.
    Thanks & Regards,
    Ramanathan

    Hi Ramanathan,
    You can run Import Master Data DM package in BPC to perform delta master data load. While you run DM package you get option to load Master Data from BW/BI where you can select:
    1. MERGE: this will keep old data intact and also load new master data, and
    2. COPY and REPLACE: This will copy new data and delete old master data.
    As per your requirement, you need to select the First option. If you select Update option then it will not delete old master data, instead update the members and hierarchy according to the parent-children design which you would have given in the dimension membersheet.
    Hope this corresponds to your requirement.
    Rgds,
    Poonam

  • How to transfer a smartform from $temp package to my own package say "zpack" in abap?

    hi, i am sanjeev.
    earlier i used to save all the objects in local package only. whether it's a program or any class or any user created table.
    but now i have created my own package and want to transfer all of those created objects into my package "zpack". even i transferred all the programs. but the smartforms i cant. so plz help me.
    THanks in advance.

    TC --> SE03
    Select --> Change Object Directory Entries --> Click F8 or Click run button .
    Check 'Check Box' and enter SSFO . Input field enter your Smart form name.
    Under that we have block " Further Restriction" enter existing Package name ex: $TMP is this is saved under temporary folder.
    and click on F8 or Run Button. Then we will get list of object's stored under this package .
    Select required object and click on "Object  Directory ", this will prompted pop asking to enter new package name.
    This will help you to change from one package to your owned package.
    Thanks,
    Venu M B

  • How to import a tcl package in Java

    Hi,
    I want to convert an existing tcl file into a java source file. In my existing tcl file, some tcl packages have been imported, using the syntax
    package requires XML
    where "XML" is the name of a tcl package.
    But I am not sure how to import this tcl package in my Java code. Also, how can i call tcl procedures from Java code. The tcl package file contains a set of tcl procedures.
    Please let me know that
    1> How can I import/call a tcl package in a Java code.
    2> How can I call a tcl procedure in a Java code. The tcl procedure is contained in the tcl package file.

    I have searched the url provided by you. But I couldn't find anything relevant to my requirements.
    They have basically explained about how to call a Java program from a tcl code using java::call command
    But they haven't provided anything related to importing tcl package files inside java source.
    Please let me know your opinion on this issue.

  • Import javax.mail package does not exists

    Hi,
    when i tried to compile the source code for email using jdk1.3.1, it compiled fine. but when i tried to compile using jdk1.4.., it had the following errors such as
    import javax.mail package does not exists,
    import javax.mail.internet package does not exists
    package javax.activation does not exist
    Is it because of the jdk version problem???
    Pls help me

    I have the same problem with javax.ejb
    Now i've downloaded and installed the j2ee and set my classpath to the j2ee.jar. I've had to make a new path cause i'm running XP.
    This doesn't work.
    to compile it in Jcreator or JBuilder I can make it work by adding this package (j2ee.jar) in the project settings - required libraries.
    But I have to do this for every project again and again.
    I can make it work but i thougt the classpath would be enough ??
    Bassegio

  • When my husband set up my iPad, he imported my daughter's phone contacts.  Is there a way to delete her contacts and import my own?

    When my husband set up my iPad, he imported my daughter's phone contacts.  Is there a way to delete her contacts and import my own?

    The iPad must always be synced to one computer using the Apple ID that it was originally synced to. Otherwise all apps & files will be deleted. There's no way to retrieve once erased.
    Is there a backup on a different computer?
     Cheers, Tom

  • Problem in importing ESS Business Package in EP 5.0

    Hi
    I am aiming at importing the ESS 4.6C Business Package which is a zip file into EP 5.0. At the time of import i receive a prompt saying that the files with only the following extensions can be imported into the portal.
    The file extensions that can be imported into the portal:
    CDF, XML, IVU, PCK, IVS, PAG, PGS, ROL, FLD, PIV, TPL.
    Can anyone suggest the method of importing the ESS Package into EP 5.0?
    Thanks in advance
    Regards
    Priya

    Hi
    Check the zip file to see if there is a .pkg file, the pkg file contain definitions on what are the associated files (CDF, XML, IVU, PCK, IVS, PAG, PGS, ROL, FLD, PIV, TPL). Try importing the pkg file (unzip zip).
    Regards
    Pran

  • How to Import a DTS Package, while keeping version History in Destination Intact

    Hi Guys,
    Not sure if this is the right forum for my question. But I couldn't find any other DTS forum to post my query.
    Basically, I have my Production Environment in SQL 2008R2 and it contains few DTS [NOT SSIS!!!!] packages in Management > Legacy. One of those packages, Let's say is, 'PackageA.dts'.
    Now for the PackageA, we have versions of last couple of years (almost 11 versions we have for this package), recently in Test Environment (again, SQL 2008R2) we made Lot of changes to that Package and now we want bring that package from Test Env. to Production.
    But a) we prefer not to 'open it in Prod then make all individual changes one by one' rather we just need to kind of overwrite/replace our existing Production Package   b) also, we don't want to loose version  history for the Existing PackageA.dts
    in Production, so anytime we can rollback when required.
    Any Idea if I can? [Please don't post non relevant answer like, convert DTS to SSIS. Sorry if I sound rude, really will appreciate if some one can try helping me.]  
    Regards, Avik M.

    Hi ArthurZ... "...No deletions, just import, it overrides the prod package" --- Is that the
    case? If so, it could have resolved my issue I guess. But that's not happening...
    If I don't delete and try to import same named package, I get below error::
    TITLE: Object Explorer
    DTS Package 'PackageA' already exists with a different ID in this category. (Microsoft OLE DB Provider for SQL Server)
    Regards, Avik M.
    EDIT: Also, I found another Post : dts-package-already-exists-with-different-id-in-this-category which
    says, we need to basically delete the existing Package to import same named package. -- Just opposite of what you mentioned ArthurZ. So what's the conclusion?
    I need to understand why the same package that I'm bringing from a different server is not just creating a new version if that package name already exists?
    Any workaround Microsoft?

  • Unable to import CRM Business Packager in the Portal

    I have downloaded the Business Package for CRM, but it was in Zip file.
    I was unable to import it in the Portal since EP6 format has to be in epa not zip?
    Please advise.
    AA

    Hi,
    CRM 4.0 Business package is available for EP 5.0 and above. When importing the business package do pay attention that you import a zip file that contains objects that are EP 5.0 version compatible such as files ending with the "PKG" extension. "EPA" extension is acceptable from EP 6.0 on.
    The package content will be available at "migrated content" in your PCD, after the import process is done.
    Regards,
    Haguy

Maybe you are looking for

  • Using  so_new_document_send_api1 ?

    hi there, i am using FM  so_new_document_send_api1 for sending emails from z-abap. is there any possibility that i can send the email IMMEDIATELY ? now it is getting into the queue (in SCOT). there we have a job running every 5 minutes which sends th

  • How to set different ringtones for contacts ?

    hi!, i got my iphone friday night and ive tried setting different ringtones for different people..but it doesnt work...my normal ringtone is disturbed..when my friends call..i want it to be different for each one of them..i changed it in the contacts

  • Force quit Preview after Maverick

    I installed Mavrick about 3 weeks ago and have had nothing but trouble. I am having to force quit some program everyday; preview (being the worst), finder, numbers, whatever. Preview will open the document but then I can't scroll and have to force qu

  • Browser, Split VIew, Viewer and other Icons are Disabled after Import

    If I import from an SDHC card, occasionally the Browser, Split View and all other toolbar icons except for "new" become disabled "grayed out" but the corresponding Menu options work fine. I just installed Aperture, and was not a Aperture 2.0 user, so

  • Showing Empty cartons in Packing

    Hi All, I have scenario in packing where business packs empty cartons physically in the pallets to fill the empty space. The information of number of empty cartons is then entered in the header text. Right now these empty cartons does not appear in S