Accessing a Jar file within my jar...

Hi,
I've got a JDBC Jar file that I wish to include in my Jar package, but I'm unsure how to do this...
I'm using ant to compile my code & package it up into the Jar, & I can get it to compile fine, and package everything up fine (including the JDBC jar), but when I go to run the app I get an error
(No suitable driver).
My app works fine without being Jar'ed up.
I'm guessing that I need to set the classpath to reference the JDBC jar file in my jar... but I'm unsure how to do this.
Any help would be greatly appreciated.

package what you thirdpart jar file and your jar file to one jar file..
it will run ok.
maybe the below tool can help you.
a tool named JavaJar(written by java) can compress and decompress jar,war, ear and.zip...
may download from http://www.qwerks.com/download/4114/JavaJar.zip
the tool is very verygood tool.
but the homepage(www.pivotonic.com) of JavaJar cannot be accessed.
it is funny.
good lucky.

Similar Messages

  • Access a data file within a jar package

    hello, everyone
    I got a problem in locating a data file packaged in jar file.
    For example, in foo.jar there is a data file with the directory path "d1/d2/data.log". In the command line, I want to access that data file by making it as an input to the Main class which will load data.log at runtime. However, it reported exception of "no such file or directory". In the command line, I input:
    java -classpath foo.jar d1.d2.Main d1/d2/data.log
    any suggestion?
    Thanks
    Chinyi

    I don't understand what you're trying to do by including d1/d2/data.log in the commandline? It appears to be extraneous and invalid.
    Assuming:
    that the class you want to execute is Main.class in foo.jar, and that its path in the jar is di/d2, and
    that Main uses d1.d2.data.log when it access this file, it should work.

  • Viewing PDF files within your browser

    Ever since I updated to a newer version of the reader (about a week ago), every time I try to access a pdf file within my browser (Firefox), I get the message "The version of Acrobar Reader currently running cannot view PDF files within your browser..."  Does anyone have a fix?

    I installed Adobe Acrobat Reader 9.3 last night and started having the same exact problem.  This morning I went to START and using the "Start Search" feature box typed in "Adobe" because I wanted to see if I still had any older Adobe Acrobat Reader files on my computer that were competing with 9.3.  As soon as I typed "Adobe" and clicked on the magnifying glass (or just hit "enter") I received a message that Windows was initializing Adobe Acrobat 9.3.  After it finished initializing everything worked perfectly.  The problem appears to be that Windows is not initializing the download automatically upon restart.  Maybe my fix was a fluke, but it is working fine now.

  • File within jar

    I created a jar file for my application using eclipse
    within my project i have some file my application uses as images
    i have a issue with the path to write to access those files
    currently although all those files are already in the jar i have to create a folder duplicate those files and copy the jar in that folder to be able to use my resources.
    to be more specific assuming i have
    Package1
    Package1.class1
    Package2
    Package2.image
    what will be the path to write in class1 to open the image file?
    I print out the directory while the program is running and it is the directory in which the jar file is
    so i use this path
    ./myproject.jar/package2/images
    in class1 code but it can not find the file(no such file error)
    My question is what is the path to write in class1 to open a file located in package 2
    Thanks

    The relative path to an image file or other resource file is always in relation to the current class file that is executing.
    So your class in Package1 cannot have access to an image in Package2.
    It is just impossible.
    The only way to do this is to move your image files at a location relative to the class that requires the files within Package1.

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • How To Access a jar file present outside the war file through a jnlp

    Aoa
    I m new to this forum
    I m having problem with my jnlp file
    i want to know is there any way to access a jar file through jnlp.The problem is that my jnlp file is present in the war file
    and i want to know how to acess a jar file through this jnlp.The scenerio is as below
    I m using ear file on jboss.Its hirerchy is as
    -PAN-war.war
    -launch.jnlp
    -PAN-app-client.jar
    my jnlp file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/" href="PAN/launch.jnlp">
    <information>
    <title>PanEmirates</title>
    <vendor>M Fazal Ur Rehman</vendor>
    <description>PanEmirates</description>
    <description kind="short">PanEmirates</description>
    <homepage href=""/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="PAN-app-client.jar" download="eager"/>
    <jar href="lib/javafxrt.jar" main="true" download="eager" />
    <jar href="lib/Filters.jar" download="eager"/>
    <jar href="lib/javafx-netbeans-fxuserlib.jar" download="eager"/>
    <jar href="lib/swing-layout-1.0.3.jar" download="eager"/>
    </resources>
    <application-desc main-class="net.java.javafx.FXShell">
    <argument>pan.Main</argument>
    </application-desc>
    </jnlp>
    when i run launch.jnlp file it says unable to download resource http://localhost:8080/PAN/PAN-app-client.jar
    how to access this jar file
    Any help or comment would be highly appreciated
    Regards
    M Fazal Ur Rehman

    Excellent question. I don't see any client-jar in your EAR file structure. So I am assuming you are writing a separate client application which will talk to the ejbs deployed as part of this EAR. You need to do the following:
    Write another EAR file with the following structure:
    ear:
    META-INF/application.xml
    util.jar
    client.jar
    client.jar should have a META-INF/MANIFEST.MF and that should contain Class-Path:util.jar and value for Main-Class attribute.
    Now deploy this new ear to your application server and execute it using Application Client Container that comes with your app server.
    If you don't want to write another EAR file, then bundle th client.jar in your original EAR file.
    Points to note are:
    you have to repackage util.jar again inside this ear file.
    For portability reason, you should use Class-Path manifest entry in client.jar. Refer to http://java.sun.com/j2ee/verified/packaging.html and J2EE platform spec section #8.2.
    Hope this helps,
    Sahoo

  • Accessing a jar file

    Hi all
    Is it possible to access a txt file that is in a jar file???
    That is , I've created a jar file that contains a txt file, now in my script, I need to access this txt file, is this possible?
    Thanks , Dave

    Yes.
    See http://java.sun.com/docs/books/tutorial/jar/index.html for the specific details and sample code.

  • Can't able to access the Jar files which is kept inside the folder.

    Hi,
    I am using the eclipse IDE, my project folder contains the folders src, bin, .metadata, .settings
    if i place the jar file in the same location of the above mentioned folder means i can able to use the Jar file in eclipse(in my project).
    But i create one folder in the same location in the name of Jar or anything and all jar files are placed inside the folder,then i can't able to access the jar file in eclipse(in my project).
    How i can solve this problem?

    RajivGuna wrote:
    ..How i can solve this problem?Put Eclipse aside for the moment and learn how the SDK tools work at the level of the command line, then you will be much better placed to figure how to do it in the IDE. If you are still having problems, I suggest you ask on an [Eclipse forum|http://www.eclipse.org/forums/].

  • Using External JAR file within Web Dynpro DC

    Hi,
    I have created a Web Dynpro DC and I need to use an external JAR file.
    I want to use this external JAR file within the same Web Dynpro DC and NOT creating another DC to house the external JAR file as I can see from the blog.
    I have included the external JAR file in the "lib" folder of the Web Dynpro DC.
    When I tried to perform a DC build, it keeps complaining error....
    How should I solve this problem...
    Thanks.
    mike

    Hi Mike,
    Go through the below which might help you.
    Re: Lookup of RFC Destinations
    Re: Import a Java Bean from a different DC
    Web Dynpro References
    Re: j2ee library with webdynpro
    Re: Web Services :HTTP Destination not getting resloved.
    http://help.sap.com/saphelp_nw70/helpdata/en/46/3ce3e4df201d63e10000000a11466f/frameset.htm
    Thanks n Regards,
    Jhansi Miryala

  • Accessing a File within a zip, which was archived using Applet Tag

    Hi,
    Could Any one please tell me, How to Access a File from within an Applet. The File resides inside a zip which was Archived using <Applet> Tag.
    Actually, I want to write an application which runs both online and offline. So I have chosen Applet and All the files Which I need are zipped and is Archived through <Applet ARCHIVE="example.zip">.
    Now I want to access those XML files which are inside example.zip from my Applet.
    How can I do that?
    I think I will get security Exception.
    How to get rid of this security Exception.
    Kindly Answer soon.......
    It's very urgent.
    Thanking you,
    KumudaRaj

    Did you already try signing a jarfile? If no ->>
    You can call a class inside a jar-file within the applet.
    if this class should be able to acces files the jarfile
    first has to be signed. to do this, you must generate a key.
    the complete work:
    1. write your applet
    2. write a html-page with following code:
    <APPLET code="guestbook.class" archive="guestbook.jar" width=600 height=400></APPLET>
    3. make a zip-file with the guestbook.class, guestbook.form, guestbook$1.class, guestbook$... and rename it to guestbook.jar
    4. in the console type:
    keytool -genkey -alias YOURNAME
    5. sign the key to your jarfile with:
    jarsigner guestbook.jar YOURNAME
    6. try the applet. a warning should appear which you have to answer
    with YES then it should work
    my trouble is that i cant acces files anyway because right now i don�t
    alreadv have the clue to get the right (absolute?) path for the file. means i get an ioexception because the applet cant find the file :-((
    does anyone know how to solve this problem then? my code is:
    FileReader Stream = new FileReader("/members/Ui97u8g4f6b89mj90kh5gbr4ecf6KXC4/guestbook.txt");
    ...

  • Accessing JAXR registry from within web service

    Hi I'm having trouble accessing the registry from within a web service running in the tomcat server.
    The service should register with the registry at startup, but in the logs from the tomcat server I can see that a JAXRException is thrown:
    javax.xml.registry.JAXRException: Unable to create ConnectionFactory: Provider com.sun.xml.registry.common.ConnectionFactoryImpl not found
         at javax.xml.registry.ConnectionFactory.newInstance(Unknown Source)
    If I run the program from outside the tomcat server as a standalone program, it registers perfectly.
    I believe the problem is that it is missing one or more jars.
    I have tried to put the jaxr-jars under shared/libs but that hasn't solved the problem.
    Has anyone an idea of what I'm doing wrong?
    Help is greatly appreciated!
    / Bo

    Hi swatdba
    I know that the build file states alle the packages that I need, and as I said, if I run my program like the regular JAXR examples, it works fine.
    The thing is, the JAXR examples are not web services on their own. They are merely Java programs that access the registry.
    In my case I am building a web service that should run in the tomcat server. When it initialises, it should register with the register, and also be able to search for other web services.
    I thought this would be possible per default, ie. the jars that the web service needs should already be available in the tomcat server, but it doesn't work. I have tried to put the jars that I've found in the build script in the folder C:\jwsdp-1.3\shared\lib, which according to the tomcat manual should be used to put jars that you want to share between your web services.

  • Class not found in web-inf/classes folder of war file within ear file

    Hi all,
              I am using Weblogic 8.1 sp4. I have a war file within an ear file. I am trying to deploy the war file with a few classes within its web-inf/classes folder, however when the classes are in that folder I consistently get a class not found exception when trying to instantiate them. If I package the classes in a jar file and then put that jar file within the web-inf/lib folder of the war, the classes are also not found.
              If I put these two classes in the app-inf/classes folder of the ear file, everything works as expected and the classes are found.
              Any ideas of why this is happening. This seems to be a very simple thing that should work, but appears to not be working at all.
              thanks in advance for any suggestions or ideas.

    Hi,
              This is a known limitation/issue with WL. There is also no way around this.
              Regards,
              LG

  • ORA-12705: Cannot access NLS data files or invalid environment specified

    Hi,
    I am using Oracle 10g Express, ojdbc14.jar , apache tomcat 5 server on Linux (Fedora 6).
    In CustDisp.JSP I have following code:
    <%
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
    out.println("JDBC driver loaded.<br>");
    catch (ClassNotFoundException e) {
    %>
    error :<br>
    <%=e.toString() %>
    <%
    String sql = "SELECT custid, fname, lname FROM customers";
    try {
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","myid", "mypassword");
    out.println("Connection made.<br><br>");
    Statement s = con.createStatement();
    ResultSet rs = s.executeQuery(sql);
    %>
    When Itry to access http://localhost:8080/jsps/CustDisp.jsp,I get following error:
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified.
    When I display enviorenment parameters in this JSP, I get follwing:
    JDBC driver loaded.
    Oracle Home = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server
    Language = en_US.UTF8
    NLS Language = AMERICAN_AMERICA.AL32UTF8
    Path = /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    Class Path = /usr/lib/jvm/java/lib/tools.jar:/usr/share/tomcat5/bin/bootstrap.jar:/usr/share/tomcat5/bin/commons-logging-api.jar:/usr/share/java/mx4j/mx4j-impl.jar:/usr/share/java/mx4j/mx4j-jmx.jar
    Charset = null
    Home = /usr/share/tomcat5
    Log Name = tomcat
    LD LIB PATH = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data/ojdbc14.jar:
    Locale = en_US
    nls data directory : /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data
    I have checked permissions for nls data folder, they are :
    Owner: Oracle
    Folder Access: Create and delete files
    Group: Dba
    Folder Access: Access files
    Others
    Folder Access: Access files
    Execute: Allow executing file as program.
    I have written a java program and used same drivers,customers table and connection i.e
    Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
    String sql = "SELECT custid, fname, lname FROM customers";
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","myid", "mypassword");
    it works fine and displays customers.
    Only when I try to access my CustDisp.JSP, I get
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified. Error.
    Can some one please help me sorting out this problem?
    Thanks in advance.
    AQK

    Hi,
    Relevant code for CustDisp.JSP is given below:
    <%@ page session="false" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <%@ page import="oracle.jdbc.*" %>
    <%
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
    out.println("JDBC driver loaded.<br>");
    catch (ClassNotFoundException e) {
    %>
    error :
    <%=e.toString() %>
    <%
    String sql = "SELECT custid, fname, lname FROM customers";
    try {
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","myid", "mypassword");
    out.println("Connection made.<br><br>");
    Statement s = con.createStatement();
    ResultSet rs = s.executeQuery(sql);
    %>
    Permissions for nls data folder
    /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data/
    are :
    Owner: Oracle
    Folder Access: Create and delete files
    Group: tomcat
    Folder Access: Access files
    Others
    Folder Access: Access files
    Execute: Allow executing file as program.
    In CustDisp.JSP I have following code which accesses ojdbc14.jar
    // Check access to the nls data files.
    cfile = "";
    try{
    File myfile = new File("/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/nls/data/ojdbc14.jar");
    if (myfile.exists() == true){
    cfile="ojdbc14.jar exists in the data directory. Its length is "+ myfile.length()+" It can be read =" myfile.canRead() " , can be written = " + myfile.canWrite();
    }else{
    cfile="ojdbc14.jar does not exist.";
    catch (Exception er){
    %>
    error in reading file:<br>
    <%=er.toString() %>
    <%
    This code gives following output:
    File ojdbc14.jar exists in the data directory. Its length is 1536979 It can be read =true , can be written = false
    Every things seems to be OK but when I try to access http://localhost:8080/jsps/CustDisp.jsp, Iget:
    Sql Error:
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-12705: Cannot access NLS data files or invalid environment specified
    Best regards.
    AQK

  • How can i locate the properties files within a ejb container?

    when i develop servlet+javabean structure application,in order to imploement decoupling,i
    would like to write the config information in the properties files(key-value pair),in
    servlet,i use "getResourceAsStream(String relativePath)" method to retrieve the
    configuration information from the properties files(i even write the SQL clause
    in the files),it alwsys works well.
    now,i want to implement such function within the ejb container,that is to read
    a properties file from session bean,but i don't know how can i locate the file
    within the ejb container by using relative path,i wonder if there is the same
    method within ejb container as "getResourceAsStream(.......)" method within servlet
    container?
    thanks for any helps!
    the code snippet is appreciated!

    In general, you should look at using environment entries (variables) in the
    deployment descriptors (both the war and EJB jar rather than properties
    files for configuring J2EE applications. The reasons for this are many:
    1. This is the official way to do it according to the spec. Properties
    files are the J2SE way of doing things
    2. As you note, that it's not obvious how you would (legally) read a
    properties file inside an EJB.
    3. It's consistent between the web and EJB part of your code
    4. the weblogic console and tools have good capabilities to edit these
    fields.
    Kent
    "zhebincong" <[email protected]> wrote in message
    news:[email protected]..
    >
    when i develop servlet+javabean structure application,in order toimploement decoupling,i
    would like to write the config information in the propertiesfiles(key-value pair),in
    servlet,i use "getResourceAsStream(String relativePath)" method toretrieve the
    configuration information from the properties files(i even write the SQLclause
    in the files),it alwsys works well.
    now,i want to implement such function within the ejb container,that is toread
    a properties file from session bean,but i don't know how can i locate thefile
    within the ejb container by using relative path,i wonder if there is thesame
    method within ejb container as "getResourceAsStream(.......)" methodwithin servlet
    container?
    thanks for any helps!
    the code snippet is appreciated!

  • How do I import any extension file within project in netbeans ?

    Can anybody tell that how can I add any text file or any extension file in netbeans project as I can import image within project and I can use that image when I run jar file..I do not have to move that image where I run my jar file..It will automatically take that image file from jar file...I want this thing same for files...In which I can read and write within project....(I m using netbeans 6.0 and jdk 1.6)
    Thanks...

    Thank you for yr prompt reply.
    May i try to explain once again.. I want a way to store a file (*.txt) in a package called "files" within my project. Now after compiling and making an executable jar of this project i wish to read and write to this *.txt file lying within files package. Though I m able to read this *.txt file ( with the help of getClass().getResourceAsStream() ) but i m unable to make any changes to this file within xxx.jar.
    ex:
    FileWriter fw = new FileWriter("c:/xxx.jar!/files/xyz.txt");
    Do u have ny idea? how can i do this ?
    can u plz suggest the correct forum for netbeans. Thanks once again.

  • Question re Accessing catalogues and files from an external hard drive in Elements 6.

    Having just acquired an ehd, I have successfully carried out a trial back up of an Elements 6 2000 picture catalogue from an XP based PC, using the Elements 6 full back-up process. This process is intended to be used eventually to transfer this and other catalogues onto a new Windows 8 PC installed with Elements 11.
    However, in the interim I would also like to be able to access the picture files and the catalogue data on the ehd from a Vista based laptop which also has Elements 6 installed. Can you please advise how to do this without carrying out a full restore process that would load all of the files onto my laptop's hard drive.
    In transferring the picture files to the ehd I also seem to have lost the original file structure that was on my PC, as folders have been renamed numerically and are all held individually in the main folder of the ehd. Whilst this doesn't matter too much whilst the files remain on the ehd, provided the catalogue still knows where to find them, has the original file structure been permanently lost, or can I recreate it when I eventually restore the files and catalogue on the new Windows 8 PC?
    I'm anxious to get this process right as I have a much larger catalogue to similarly back-up and transfer, once I have acquired the new PC, and was hoping to be able to similarly access this catalogue by my laptop from the ehd as there is insufficent hard disk space on my laptop to hold all the 20,000 files involved.
    Please help
    Gardener 179

    Thanks for your help re my original questions. 
    Reassured regarding not having lost the file structure of my pictures, and bearing in mind the relatively small catalogue I had backed up, I thought that rather than restoring by leaving the picture files on the EHD, I would after all restore to the laptop hard drive, as a trial run before dealing with my main catalogue. 
    The restore was successful but raised a number of further issues that I would appreciate your advice on:-
    1) The original catalogue name was not used in the restoration process. The restored catalogue on the laptop has simply been named "Pictures". Is this normal and if I now rename the restored catalogue will this create problems with any subsequent supplementary backups of the catalogue?
    2) In restoring the catalogue I heeded the Adobe Help and specified the Vista folder C:\Users\Maurice\Pictures as the location for the picture files rather than simply restoring the original XP folder structure. However, since I also wanted to retain the lower level folder structure of my XP files (which are basically date files) I then specified to "Retain the Original Folder Structure". This has resulted in the full XP folder structure being created within \Pictures on the laptop.
    Is it possible to avoid this situation occurring, or will I have to remove the unwanted XP sub-folder structure from the laptop and reconnect the thumbnails in the Photoshop catalogue to the new file locations? Also if I have to move files in this way will I once again have problems with any subsequent restorations of the same catalogue?
    I have also a couple of supplementary questions re the initial backup to the EHD which I have now looked at more closely:-
    1) The original XP catalogue has 1853 picture files, (and this is identical to that subsequently restored on the laptop), yet in backing up the catalogue to the EHD it seems that in excess of 2200 picture files have been created. Why is this?
    2) As previously advised the pictures are held on the EHD numbered sequentially as "b000001" etc, and due to my selecting the EHD top level root folder as the destination for the back up are held in F:\. Should I have created a new folder, say "Backup 1" on the EHD, and then specified this as the destination folder, as I am concerned that on backing up further catalogues the existing picture files will get overwritten and the Photoshop Backup and Catalogue files confused with previous backups? If so can I move the existing back up files to a new folder now without causing any problems?
    Finally could you confirm what would have happened to the folder structure on the EHD had I carried out the Restore process by locating the picture files on the EHD but retaining their original file structure. Would the picture files have been copied into their original file structure for use by the restored catalogue and the duplicate backup files left unaltered, or would the backup picture files have been replaced by the restored file structure? Also would the "catalogue file" be transferred to the Laptop C:\ drive in this process or would this also stay on the EHD and be accessed from there by Photoshop?
    Sorry for all the questions but I really want to fully understand what is going on before risking doing anything to move my main catalogue.
    Regards

Maybe you are looking for

  • DVDs to transfer music

    I know that you can move music from one iTunes account to another using CDs, but can you also transfer songs on DVDs? Or can DVDs only be used for data backup? (I mean, how could a DVD serve as data backup if you couldn't take songs from a DVD backup

  • SAP Help Doc on Query Views in BW

    Hi   I am preparing Documentation.   Is there any SAP help document avaliable that explains what are VIEWs developed in Analyzer ....there filters...etc Thanks

  • Right 2 inches dark

    I just got my computer and love it, but I've noticed that on the right side of my screen, there is a 2 inch bar where the screen itself is darker than the rest of the display. Is this normal? Is this a "Mac" thing? It's sort of annoying. macbook 13 i

  • Overlapping between operations in PPDS

    Hi, I have one finished product and it has 2 semifinished products as components.If we run PPDS.Now my finished product 1st operation starts after completion of 2nd semi-finished product.But my requirement is finished product should not wait till arr

  • My icloud is saying its had to many number accounts and wont work

    can someone help i bought a used second hand iphone 4 of someone and i have gone to set it up and i cant long into icloud it keeps saying "the maximum number of free accounts have been activated on this iphone" i dont know what i have to do to get it