Unchecked call to TreeSet

So, I'm trying to do something which I thought was fairly simple.
I have a very simple record class who's only members are two strings and then there are the usual set/get methods. Let us call it class Foo.
Now, I want to have a set of Foo's which keeps ordering based on first member, second member (e.g., like lastname, firstname). So, I build FooComparator which implements compare and equals. I then create my set class like this:
public class FooSet extends TreeSet {
        public FooSet() {
        super(new FooComparator());
}and I get:
FooSet.java:23: warning: [unchecked] unchecked call to TreeSet(java.util.Comparator<? super E>) as a member of the raw type java.util.TreeSet
super(new FooComparator());
FooComparator looks like this:
public class FooComparator implements Comparator, Serializable {  
        public FooComparator() {
        super();
    //impl of compare() and equals()
}My two questions are:
1) Is this warning ignorable?
2) If not, what is the correct fix?
Thanks, everyone.
Best,
Glenn

The warning isn't a biggie... I'm pretty sure it's because you're not using generics. So lets say your your record class is called FooRecord. If you changed your code around to this, it should be fine.
public class FooSet extends TreeSet<FooRecord> {
        public FooSet() {
            super(new FooComparator());
}There might be a cleaner way to implement this (I'm not too clear on generics) but I'm pretty sure that'll do the trick. Once you get into generics they're awesome and make things a hell of a lot easier.
-Thomas

Similar Messages

  • Warning: [unchecked] unchecked call to getMethod when updating to JDK 1.6

    I'm received the following compilation warnings after I switched to Java 6 from Java 5:
    warning: [unchecked] unchecked call to getMethod(java.lang.String, java.lang.Class<?>...> as a member of the raw type java.lang.Class
    removeChangeListener = myParent.getMethod("removeChangeListener",
    changeListenerParameterTypes);
    The code is this class is instantiated by many classes. The class instantiating this class is passed through a constructor.
    Here is a partial code snippet of the class, constructor and method where the warning occurs:
    public class DumpDisplay extends javax.swing.JFrame implements javax.swing.event.ChangeListener
    private Class changeListenerParameterTypes[] = new Class[2];
    public DumpDisplay(Object mvc)
    Class myParent = mvc.getClass();
    public void removeListeners()
    Method removeChangeListener = null;
    changeListenerParameterTypes[0] = ChangeListener.class;
    changeListenerParameterTypes[1] = Integer.TYPE;
    // Get the removeChangeListener method from the MVC class
    try
    removeChangeListener = myParent.getMethod("removeChangeListener",
    changeListenerParameterTypes);
    catch (NoSuchMethodException e)
    System.out.println(" DumpDisplay class addChangeListener method: "+e);
    This compilation warning does not appear in JDK 1.5. Any assistance is greatly appreciated.

    Class myParent = mvc.getClass();Class<?> myParent = mvc.getClass();

  • Unchecked call to to add(E) ....... HELP

    Hi, i was doing a project in eclipse, and everything was fine (compiled and running). However, I ran into this problem when I try to compile the same code in DOS command line. Is there any ways that I can fix this problem so the same code that runs in Eclipse can compile in DOS also?
    a glimpse of the code is below:
    ArrayList best_move  = new ArrayList();
    for ( ..r... )
       for( ..c.... )
           Move  move = new Move( r, c);
           if( move is valid )
                then
                    best_move.add(move);warning: [unchecked] unchecked call to add(E) as a
    member of
    the raw type java.util.ArrayList
    best_move.add((Move) move);Appreciate your help.

    try the following
    ArrayList<class name> best_move  = new ArrayList<class name>();
    for ( ..r... )
       for( ..c.... )
           Move  move = new Move( r, c);
           if( move is valid )
                then
                    best_move.add((class name)move);in above "class name" is the class of the object which u wanna store in the collection e.g java.lang.Integer or java.lang.Float etc.
    this will not give any warnings in jdk1.5 and will help u out.

  • Unchecked Call to addElement(E)

    I'm trying to store AudioClip objects in a vector. It compiles with a warning:
    AudioHolder.java:19: warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
              soundVector.addElement(temp);
    Temp is an AudioClip, but even when I make it something simple like an int or a String, it still throws up the same warning. At runtime, the line of code comes up with a nullpointer error. Can someone help me figure out how to fix this?

    The unchecked warning is just that: a warning, which you can safely ignore. All it's saying is that you could have taken advantage of the greater type-safety provided by jdk1.5 generics, for example:  Vector<AudioClip> soundVector = new Vector<AudioClip>();
      AudioClip temp = getAudioClip(); // or whatever
      soundVector.addElement(temp);  // no warningThe NullPointerException is not related to the unchecked warning. You probably tried to call a method or access a field on a null reference.

  • "unchecked call to put(K, V)..."

    Hi, I was till recently using this passage -
    public static final Hashtable map = new Hashtable();
    static {
    map.put(TextAttribute.FONT, new Font("Serif", Font.PLAIN, 14));
    to enable me to pass map into an AttributedString constructor.
    On upgrading to j2se 1.5, I now get this warning from javac: "unchecked call to put(K, V) as a member of the raw type java.util.Hashtable"
    Can anyone explain to me what this means and what to do? (Can't find any of these words in the API).
    Thanks
    Tom

    try here:
    http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html
    In Java 1.5 you can type what goes into the collection to stay away from runtime casting errors.

  • Removing unchecked call warnings

    I have moved from 1.4.2 to 1.5.0 today, and now I'm trying to solve all the unchecked call warnings that I had in the code, but I have one that I don't know how to avoid it.
    I need a matrix of nxn dimensions where every element is an Integer. I was creating this matrix in a recursive way, with a recursion deep of n. For example, if n=3, I had finally a Vector<Vector<Vector<Vector<Integer> > > >. As n is configurable by the user, I can't determine the data types that i must declare in the recursive calls that I use to manage the matrix.
    There is a class to implement my "matrix" in a simplest way?
    If not, there is a way to remove the warnings in the recursive calls?
    If not, I suppose that I must keep the warnings...
    Jorge

    Well, my use of the matrix is not mathematical but to represent the "real world".
    I'm working in the project previous to the University graduation, and I'm implementing a communication protocol among different computers.
    Those computers are linked in n dimensions (I have let configurable the dimensions because I think that flexibility is important for things like this).
    If n=1, the computers are linked like this:
    A - B - C -D - E -F - G - H - J
    If I have n = 2 the computers are linked like this:
    A - B - C
    | \ | / |
    D - E - F
    | / | \ |
    G - H - J
    (Well, in the post preview this last configuration looks very bad because some spaces are trim: The "E" computer is linked to all the rest of computers)
    If I have n = 3 the computers are linked in a cube shape, if I have n = 4 in an hipercube, and so on.
    That's why I need a multidimensional matrix to represent my network.
    I have a class that encapsulates the access to all the linked neighbours of a computer, and internally it stores these neighbours as a Vector of Vector's. of Vector's...(n times)
    For example, to create all the neighbour objects, I must write code like this:
    private Vector neighbours; // I don't know what I must write inside <> next to Vector declaration
    neighbours = new Vector(LINKS_IN_DIMENSION); // Again, the warning complains the lack of <>, but I don't know what goes inside
    initializeDimensionVector(1, neighbours);
    // In the method declaration, I need again the <> specification but is not possible
    private void initializeDimensionVector(int dimension, Vector vecDimension)
         vecDimension.setSize(LINKS_IN_DIMENSION);
         if ( NET_DIMENSIONS == dimension )
              for ( int i = 0; i < LINKS_IN_DIMENSION; ++i )
              vecDimension.setElementAt(new NeighbourDirectlyConnected(), i);
              return;
         for ( int i = 0; i < LINKS_IN_DIMENSION; ++i )
              // And finally here, for the new recursive call, the unspecified Vector declaration appears again
              vecDimension.setElementAt(new Vector(LINKS_IN_DIMENSION), i);
              initializeDimensionVector(dimension + 1, (Vector)vecDimension.elementAt(i));
    }The number of dimensions n is represented by NET_DIMENSIONS.
    The other constant (LINKS_IN_DIMENSION) tells how many different indexes we have per dimension.
    Hope this sample code explains a little bit what I'm trying to do.
    I can close my eyes and forget the warnings, but I come from the C++ world and experience tells that warnings musn't be ignored.
    Regards and thanks for your help.
    Jorge.

  • Unchecked call: stack.push()

    Hi,
    When I compile my stack program I get an error saying unchecked call for the following line, where variable "s" is my stack, and tempno is a double I'm trying to push onto it:
    s.push(tempno);
    any ideas?

    Stack s = new Stack();
    obviously have
    import java.util.Stack;
    at the top. bit of a n00b at this kind of thing so not sure what this problem is at all!

  • What is this? -- unchecked call to put(K,V)

    unchecked call to put(K,V) as a member of the raw type java.util.HashMap
    m.put( args[0], new Double( args[1]));
    I have code that stores a string and a double value in a map like this:
    String args[];
    m.put( args[0], new Double( args[1]));
    but I get this message when compiling with the Xlint option in javac. Why is this happening?

    Yes. I got the same compile warning when I compile with jdk1.5[jdk-1_5_0_03-windows-i586-p.exe]
    This:
    Map map=new HashMap();
    map.put("abc","def");Will get the warning like "unchecked ....."
    ====
    This:
    Map<Object,Object> map=new HashMap<Object,Object>();
    map.put("abc","def");Will compile OK.
    ====
    Is the compiler's responsible to set the default type to Object?

  • Unchecked Call to addElement(E)(resultset with vector)

    Please i am trying to retreive a number of rows with two columns and am trying to add it into a vector object and ots been giving me this error message.
    Unchecked call to addElement(E)
    my code will appear below
    import java.io.*;
    import java.sql.*;
    import com.ecom.util.*;
    import java.util.Vector;
    public class ProdCategory implements Serializable
         Vector catid=new Vector();
         Vector catname=new Vector();
         EcomConnection econ;
         Connection con=null;
         ResultSet rs=null;
         Statement stat = null;
    /*The following method is used to retrieve the values of category Id and category name from CategoryDet table */
         public String getselect()
              try
                   System.out.println("Getting IN");
                   econ = new EcomConnection();
                   con=econ.getConnection();
                   stat=con.createStatement();
                   System.out.println("Connected...");
                   String query="select Ctgry_Id,Ctgry_Name from CategoryDet";
                   System.out.println("Executing Query");
                   rs=stat.executeQuery(query);
                   System.out.println("Executing result set");
                   while(rs.next())
                        catid.addElement(rs.getString(1));
                        catname.addElement(rs.getString(2));
                   System.out.println(" ");
                   rs.close();
                   stat.close();
                   econ.releaseConnection();
                   System.out.println("Connection Closed");
                   return " ";
              catch(SQLException sqlex)
                   System.out.println("There is some problem in SQL Execution..." + sqlex);
                   return "There is some problem in SQL Execution..." + sqlex;
              catch(Exception ex)
                   System.out.println("There is some other problem " + ex);
                   return "There is some other problem ..." + ex;
         /*The following method is used to get the value of catid variable*/
         public Vector getcatid()
              return catid;

    i mearnt to say warning not errors i tried to typecast
    as in: Vector<string> catid=new Vector();
    Vetor<String> catname=new Vector();
    its stop giving me a warning but didnt work at run-time..it was saying nullpointer exception i need assitance

  • Unchecked call to add element

    I get the following warning:
    warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
    from the line:
    ((Vector)results.get( "ALL" )).addElement( new Result( date, home, hg, ag, away ) ) ;I have had no problems fixing this warning with simple lines like:
    private Hashtable<String,Object> results = new Hashtable<String,Object>() ;but as you can see it is a bit more tricky.
    The compiler highlights:
    ( new Result( date, home, hg, ag, away ) ) ;as the warning. The Result Object takes parameters <String,String,Integer,Integer,String> if that helps.
    Can anyone suggest how to fix this warning please?

    Are all values in your hastable vectors of results, or will that only be true when the key is "ALL". If they all contain Vectors you can rewrite the code as follows
    private Hashtable<String, Vector<Result>> results = new Hashtable<String, Vector<Result>>();
    results.put("ALL", new Vector<Result>());
    results.get("ALL").addElement(new Result (date, home, hg, ag, away));Or if you want to keep your code more flexible change Vector to it's interface List. That will reduce the amount of work you have to do if you decide you don't want to use Vectors any more and use ArrayLists.
    private Hashtable<String, List<Result>> results = new Hashtable<String, List<Result>>();
    results.put("ALL", new Vector<Result>());
    results.get("ALL").add(new Result (date, home, hg, ag, away));Of course none of this will work if your map contains values other than Vectors of results.

  • JDK 6: Generics: List.add() question - keep getting unchecked call warning.

    JDK 6
    Generics
    private TreeNode transactionTreeData;
    transactionTreeData.getChildren().add(moduleData);1. transactionTreeData is a TreeNode.
    2. the method getChildren() returns a java.util.List
    3. the method add() is from the Collection interface.
    I keep returning the warning message:
    "unchecked call to add(E) as a member of the raw type java.util.List"
    I understand what this means, but I am having problems rewriting these lines correctly to remove the warning.
    I've tried:
    private TreeNode transactionTreeData;
    List<TreeNode> treeList = transactionTreeData.getChildren();
    treeList.add(moduleData);But I keep returning the same warning message. I guess what is throwing me off is how to I properly add the generic statements when the List is return from a method (getChilden in this example)?
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    This is actually JSF - MyFaces Tomahawk to be exact, my mistake for not adding that in my original thread.
    I am dealing with the compiled class:
    package org.apache.myfaces.custom.tree2;
    public interface TreeNode extends java.io.Serializable {  
         java.util.List getChildren();
    }TreeNode.getChildren return a raw List as you can see, no doubt...
    Thanks,
    --Todd                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Warning about unchecked call

    What does it mean?
    warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector properties.add(prop);
    and how can I avoid this warning? what shall i check?

    If you use -Xlint, it will tell you the line number.
    Basically, though, you are compiling in j2se 1.5.0, but not specifying the type for the Vector. That is, you are using it in it's pre 1.5.0, raw mode, and it cannot do any compile time type checking for you.
    Say you were using your vector to store Integers. You would declare it as Vector<Integer> myIntegerVector = new Vector<Integer>();and the warning would go away. Now the compiler can do compile time type checking, and let you know when you are using that vector with a type other than Integer, which might not be safe.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Unchecked call

    I am creating a Avl tree that will work with any type of object and am getting unchecked call warnings with calls to compareTo.
    private Node insert(Comparable user, Node newNode)
              if(newNode == null)
                   newNode = new Node(user);
                   count++;
              else if((user.compareTo(newNode.getObj())) < 0)
                   newNode.setLeft(insert(user, newNode.getLeft()));
              else if((user.compareTo(newNode.getObj())) > 0)
                   newNode.setRight(insert(user, newNode.getRight()));
              else
                   System.out.println("Duplicate names not allowed, data not entered into tree");
              //make sure to check for duplicate handles, should be caught in signup
              return newNode;     
    public int compareTo(Object o)
              if ( !(o instanceof User) )
                   return 0;
              User rhs = (User)o;
              if(id < rhs.getId())
                   return -1;
              else if(id > rhs.getId())
                   return 1;
              return 0;//should never happen
         }How do i get rid of the compiler warnings while maintaining the abitilty to use the tree with any type of object.
    Is it just me or is all this new stuff more trouble then it is worth and makes java as ugly syntactically as C++.

    Don't be a pompous as's. I would spend the time
    learning it, if it had any value or advantage to it.
    3 casts in 1 class vs generics crap scattered in 3
    and both are equally safe.hang on a minute.
    You post code that doesn't demonstrate your problem, because it calls methods setLeft and setRight on a class (Node) we may or may not have source code for because your two methods have no enclosing class. I can't just take your code, compile it, see the error message, find a solution for you and post it back. No I have to try and work out all the bits that are missing.
    Further, your question is ambiguous so I ask which of two possible solutions you want, and give you a hint toward the solution for each. My intention there was that either you could run with the hint and solve the problem yourself, or you could come back and answer the question and we could then proceed to find a solution.
    But what happens? Neither. You just give up. Even a 3 year old knows that stubbing your toe is no excuse to go back to crawling.
    If you have no inclination to solve your problem, why did you post it in the first place?
    If I've still got your attention, then if you ever decide to retry generics, may I suggest you start simple, using the generic collections in your own classes.
    Don't try creating your own generic classes till you are confident using the ones crafted by people who had a pretty good idea of what they were doing.
    P.S. If you want to answer the question, and post something that compiles (albeit with warnings) I'd still be keen to find a solution with you.

  • Netbeans warning: unchecked/unsafe operations

    I get the following warnings when I compile my project in netbeans:
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    When I re-compiled, I get 37 warnings similar to:
    warning: [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
    all involving adding/inserting/removing elements in a vector...any ideas why?

    if you're not using 1.5, you can turn off the warnings by changing the source compability level in NetBeans. In your Project Properties, look under the Sources node at the bottom of the window you'll see a "Source Level" drop-down list. Change it to 1.4.

  • Recompile with -Xlint:unchecked for details???

    hi friends ,
    im using jdk-6-windows-i586. and apache-tomcat-5.5.26.
    In development phase i got the following error while compiling
    BeerExpert.java file. This is my model.
    Note: BeerExpert.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    But the class file is created. Is this any type of error or just warning msg.
    What is the meaning of this and what to do for it.
    Then I recompile the file with javac -Xlint BeerExpert.java or javac -Xlint:unchecked BeerExpert.java
    and the warning msg. appered as-
    BeerExpert.java:9: warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List
    brands.add("Jack Amber");
    error pos::: ^ error or warning position pointed by compiler
    4 warnings
    my source code is-
    package com.example.model;
    import java.util.*;
    public class BeerExpert {
    public List getBrands(String color) {
    List brands = new ArrayList();
    if(color.equals("amber")) {
    brands.add("Jack Amber");
    brands.add("Red Moose");
    else {
    brands.add("Jail Pale Ale");
    brands.add("Gout Stout");
    return(brands);
    Any suggestions what to do? Please..
    Thanx in advance.

    hi i have the same problem but my compiler is different
    it says note: stream.java uses or overrides depricated API
    recompile with XLINT:deprication for details
    @echo off
    :def
    color 0F
    :main
    cls
    title irans's Perfect Compiler
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    echo :: Welcome to the ultimate Serverbatch!
    echo ::
    echo :: Choose one of the options below by entering
    echo :: the corrensponding letter and pressing enter.
    echo ::
    echo :: Need a batch file created?
    echo :: http://www.Moparscape.org/smf.
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    echo :::: Main options:
    echo :::: com = Compile your server.
    echo :::: run = Run your server.
    echo :::: aur = Runs your server with autorestart.
    echo :::: bac = Backup your server files.
    echo ::::
    echo :::: Other options;
    echo :::: set = Change settings.
    echo :::: loc = Location list (co-ordinates)
    echo :::: upd = Updates
    echo :::: cmd = Command generator
    echo :::: cre = Credits
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    echo ::
    set /p mainc=:: Choice:
    if %mainc%==com goto com
    if %mainc%==run goto run
    if %mainc%==aur goto aur
    if %mainc%==bac goto bac
    if %mainc%==set goto set
    if %mainc%==loc goto loc
    if %mainc%==upd goto upd
    if %mainc%==cmd goto cmd
    if %mainc%==cre goto cre
    if %mainc%==COM goto com
    if %mainc%==RUN goto run
    if %mainc%==AUR goto aur
    if %mainc%==BAC goto bac
    if %mainc%==SET goto set
    if %mainc%==LOC goto loc
    if %mainc%==UPD goto upd
    if %mainc%==CMD goto cmd
    if %mainc%==CRE goto cre
    goto main
    :com
    cls
    title Compiling...
    echo :: Preparing for compile...
    echo :: Auto-setting envriomental variables...
    echo ::
    goto com2
    :com2
    title Compiling...
    echo :: Scanning for latest JDK version...
    echo ::
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_10\BIN" (GOTO COM10)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_09\BIN" (GOTO COM09)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_08\BIN" (GOTO COM08)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_07\BIN" (GOTO COM07)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_06\BIN" (GOTO COM06)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_05\BIN" (GOTO COM05)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_04\BIN" (GOTO COM04)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_03\BIN" (GOTO COM03)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_02\BIN" (GOTO COM02)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_01\BIN" (GOTO COM01)
    goto comerrorxxx
    :COM10
    echo :: Found JDK 1.6.0_10
    SET CLASSPATH=Files\Java\jdk1.6.0_10\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_10\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM09
    echo :: Found JDK 1.6.0_09
    SET CLASSPATH=Files\Java\jdk1.6.0_09\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_09\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM08
    echo :: Found JDK 1.6.0_08
    SET CLASSPATH=Files\Java\jdk1.6.0_08\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_08\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM07
    echo :: Found JDK 1.6.0_07
    SET CLASSPATH=Files\Java\jdk1.6.0_07\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_07\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM06
    echo :: Found JDK 1.6.0_06
    SET CLASSPATH=Files\Java\jdk1.6.0_06\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_06\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM05
    echo :: Found JDK 1.6.0_05
    SET CLASSPATH=Files\Java\jdk1.6.0_05\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_05\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM04
    echo :: Found JDK 1.6.0_04
    SET CLASSPATH=Files\Java\jdk1.6.0_04\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_04\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM03
    echo :: Found JDK 1.6.0_03
    SET CLASSPATH=Files\Java\jdk1.6.0_03\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_03\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM2
    echo :: Found JDK 1.6.0_02
    SET CLASSPATH=Files\Java\jdk1.6.0_02\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_02\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COM01
    echo :: Found JDK 1.6.0_01
    SET CLASSPATH=Files\Java\jdk1.6.0_01\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_01\bin
    echo :: Results:
    javac *.java
    echo :: Done!
    pause
    goto main
    :COMERRORXXX
    echo :: No version of JDK 1.6 was detected.wtf impossible
    pause
    goto main
    :run
    cls
    title Running Server...
    echo :: Port:
    echo :: 43594
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_10\BIN" (GOTO RUN10)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_09\BIN" (GOTO RUN09)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_08\BIN" (GOTO RUN08)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_07\BIN" (GOTO RUN07)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_06\BIN" (GOTO RUN06)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_05\BIN" (GOTO RUN05)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_04\BIN" (GOTO RUN04)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_03\BIN" (GOTO RUN03)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_02\BIN" (GOTO RUN02)
    IF EXIST "%programfiles%\JAVA\JDK1.6.0_01\BIN" (GOTO RUN01)
    :RUN10
    echo :: Running using JDK 1.6.0_10...
    SET CLASSPATH=Files\Java\jdk1.6.0_10\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_10\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN09
    echo :: Running using JDK 1.6.0_09...
    SET CLASSPATH=Files\Java\jdk1.6.0_09\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_09\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN08
    echo :: Running using JDK 1.6.0_08...
    SET CLASSPATH=Files\Java\jdk1.6.0_08\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_08\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN07
    echo :: Running using JDK 1.6.0_07...
    SET CLASSPATH=Files\Java\jdk1.6.0_07\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_07\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN06
    echo :: Running using JDK 1.6.0_06...
    SET CLASSPATH=Files\Java\jdk1.6.0_06\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_06\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN05
    echo :: Running using JDK 1.6.0_05...
    SET CLASSPATH=Files\Java\jdk1.6.0_05\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_05\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN04
    echo :: Running using JDK 1.6.0_04...
    SET CLASSPATH=Files\Java\jdk1.6.0_04\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_04\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN03
    echo :: Running using JDK 1.6.0_03...
    SET CLASSPATH=Files\Java\jdk1.6.0_03\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_03\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN02
    echo :: Running using JDK 1.6.0_02...
    SET CLASSPATH=Files\Java\jdk1.6.0_03\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_03\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed!
    pause
    goto main
    :RUN01
    echo :: Running using JDK 1.6.0_01...
    SET CLASSPATH=Files\Java\jdk1.6.0_03\bin;%CLASSPATH%;
    SET PATH=C:\Program Files\Java\jdk1.6.0_03\bin
    java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
    echo :: Failed! Need JDK 1.6.0_xx
    pause
    cls
    goto main
    :bac
    :backup
    cls
    title Backing up files...
    echo :: Backing up files...
    if not exist Backup mkdir Backup
    if not exist Backup\characters mkdir Backup\characters
    if not exist Backup\connectedFrom mkdir Backup\connectedFrom
    if not exist Backup\data mkdir Backup\data
    if not exist Backup\flagged mkdir Backup\flagged
    if not exist Backup\logs mkdir Backup\logs
    if not exist Backup\moreinfo mkdir Backup\moreinfo
    if not exist Backup\savedGames mkdir Backup\savedGames
    Echo Starting Backup Copy
    copy /V /Y /A *.txt .\Backup\
    copy /V /Y /A *.java .\Backup\
    copy /V /Y /A *.class .\Backup\
    copy /V /Y /A *.cfg .\Backup\
    copy /V /Y /A *.bat .\Backup\
    copy /V /Y /A bans .\Backup\bans
    copy /V /Y /A characters .\Backup\characters
    copy /V /Y /A characters .\Backup\characters
    copy /V /Y /A connectedFrom .\Backup\connectedFrom
    copy /V /Y /A data .\Backup\data
    copy /V /Y /A flagged .\Backup\flagged
    copy /V /Y /A logs .\Backup\logs
    copy /V /Y /A moreinfo .\Backup\moreinfo
    copy /V /Y /A savedGames .\Backup\savedGames
    echo :: Done.
    pause
    cls
    goto main
    :set
    cls
    echo :: Enter one of the following to change background colour.
    echo :: B0 = Black
    echo :: B1 = Blue
    echo :: B2 = Green
    echo :: B3 = Cyan
    echo :: B4 = Red
    echo :: B5 = Purple
    echo :: B6 = Yellow
    echo :: B7 = White
    echo.
    echo :: Enter one of the following to change text colour.
    echo :: T0 = Black
    echo :: T1 = Blue
    echo :: T2 = Green
    echo :: T3 = Cyan
    echo :: T4 = Red
    echo :: T5 = Purple
    echo :: T6 = Yellow
    echo :: T7 = White
    set /p s=:: Choice:
    if %s%== B0 (set b=0)
    if %s%== B1 (set b=1)
    if %s%== B2 (set b=2)
    if %s%== B3 (set b=3)
    if %s%== B4 (set b=4)
    if %s%== B5 (set b=5)
    if %s%== B6 (set b=6)
    if %s%== B7 (set b=F)
    if %s%== T0 (set t=0)
    if %s%== T1 (set t=1)
    if %s%== T2 (set t=2)
    if %s%== T3 (set t=3)
    if %s%== T4 (set t=4)
    if %s%== T5 (set t=5)
    if %s%== T6 (set t=6)
    if %s%== T7 (set t=F)
    color %b%%t%
    pause
    cls
    goto main
    :loc
    cls
    echo :: Below is a list of locations with their coordinates.
    echo ::
    echo :: Varrock - 3210 3424
    echo :: Falador - 2964 3378
    echo :: Lumbridge - 3222 3218
    echo :: Camelot - 2757 3477
    echo :: East Ardougne 2662 3305
    echo :: West Ardougne 2529 3307
    echo :: Al Kharid 3293 3174
    echo :: Khalphite Lair 3226 3107
    echo :: Yannille 2606 3093
    echo :: Tutorial Island 3094 3107
    echo :: Barbarian Village 3082 3420
    echo :: Entrana 2834 3335
    echo :: Heroes Guild 2902 3510
    echo :: Rangers Guild 2658 3439
    echo :: Catherby 2813 3447
    echo :: Seers Village 2708 3492
    echo :: Fishing Guild 2603 3414
    echo :: Isafdar 2241 3238
    pause
    cls
    goto main
    :upd
    cls
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    echo :: Latest updates:
    echo ::
    echo :: 1) Added Location list.
    echo :: 2) Fixed backup commands.
    echo :: 3) Added settings option.
    echo :: 4) Fixed backup to cover more file types.
    echo :: 5) Added autorestarter. This was incredibly difficult for me to do.
    echo :: 6) Added command generator.
    echo :: 7) Auto-sets enviromental variables when compiling.
    echo :: 8) Released On Mopar Forums
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    pause
    cls
    goto main
    :cmd
    :Star
    Set /p CmdName=Command Input?
    Set /p RUSure=Are you sure you want the commands input: %CmdName%(yes,no)?
    If %RUSure%==no GOTO Star
    If not Exist CommandsFolder MD Commands Folder
    Echo else if(command.equalsignorecase("%CmdName%")) >> ".\Commands\%CmdName% Command.txt"
    Echo { >> ".\Commands\%CmdName% Command.txt"
    cls
    set /p AY=addItem(yes,no)?
    If %AY%==YES Goto addItem
    If %AY%==yes Goto addItem
    If %AY%==no Goto endCode
    If %AY%==NO Goto endCode
    :addItem
    cls
    set /p ID=ItemID?
    cls
    set /p Amount=Amount Of that Item?
    cls
    echo addItem(%ID%,%Amount%); >> ".\Commands\%CmdName% Command.txt"
    Set /P AT=Add item, add tele or finish command.(AI,T,End)
    If %AT%==ai GOTO addItem
    If %AT%==Ai GOTO addItem
    If %AT%==AI GOTO addItem
    If %AT%==aI GOTO addItem
    If %AT%==T GOTO Tele
    If %AT%==t GOTO Tele
    If %AT%==end GOTO endCode
    If %AT%==END GOTO endCode
    If %AT%==EnD GOTO endCode
    If %AT%==eNd GOTO endCode
    If %AT%==ENd GOTO endCode
    If %AT%==enD GOTO endCode
    if %AT%==End Goto endcode
    if %type%==* goto error
    echo.
    goto error
    :error
    cls
    echo Commands invalid. Only use commands from the menu.
    pause
    goto menu
    :endCode
    cls
    Echo } >> ".\Commands\%CmdName% Command.txt"
    Set /p Again=Make Another (yes, No)?
    If %Again%==yes GOTO Star
    If %Again%==no goto fin
    If %Again%==YES GOTO Star
    If %Again%==NO goto fin
    :Tele
    cls
    Set /P X=XCoord Tele?
    Set /P Y=YCoord Tele?
    Echo teleportToX = %X% >> ".\Commands\%CmdName% Command.txt"
    Echo teleportToY = %Y% >> ".\Commands\%CmdName% Command.txt"
    Set /P AT=addItem Or Another Tele(not Used In Same Command Usually(AI,T,End)
    If %AT%==ai GOTO addItem
    If %AT%==Ai GOTO addItem
    If %AT%==AI GOTO addItem
    If %AT%==aI GOTO addItem
    If %AT%==T GOTO Tele
    If %AT%==t GOTO Tele
    If %AT%==end GOTO endCode
    If %AT%==END GOTO endCode
    If %AT%==EnD GOTO endCode
    If %AT%==eNd GOTO endCode
    If %AT%==ENd GOTO endCode
    If %AT%==enD GOTO endCode
    if %AT%==End Goto endcode
    :fin
    echo Command creation complete. Find it in the commands folder.
    pause
    cls
    goto main
    :aur
    cls
    echo :: Have you already set up your autorestarter? (Y/N)
    set /p ans=:: Answer:
    if %ans%==y goto ansyes
    if %ans%==n goto ansno
    goto main
    :ansyes
    cls
    call autorestart.bat
    echo Not Found!
    pause
    goto main
    :ansno
    cls
    echo :: How long between auto restarts?
    set /p hlb=:: (10min, 12min, 14min, 16min, 18min, 20min):
    if %hlb%==10min goto min10
    if %hlb%==12min goto min12
    if %hlb%==14min goto min14
    if %hlb%==16min goto min16
    if %hlb%==18min goto min18
    if %hlb%==20min goto min20
    :min10
    del ProcessKiller.bat
    del Autorestart.bat
    del Runner.bat
    echo :start >> ProcessKiller.bat
    echo PING 1.1.1.1 -n 1 -w 600000 >> ProcessKiller.bat
    echo tskill java >> ProcessKiller.bat
    echo start call runner >> ProcessKiller.bat
    echo goto start >> ProcessKiller.bat
    echo java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server >> Runner.bat
    echo exit >> Runner.bat
    echo @echo off >> Autorestart.bat
    echo :start >> Autorestart.bat
    echo Start call "Runner.bat" >> Autorestart.bat
    echo call "ProcessKiller.bat" >> Autorestart.bat
    echo pause >> Autorestart.bat
    echo goto start >> Autorestart.bat
    goto donexd
    :min12
    del ProcessKiller.bat
    del Autorestart.bat
    del Runner.bat
    echo :start >> ProcessKiller.bat
    echo PING 1.1.1.1 -n 1 -w 720000 >> ProcessKiller.bat
    echo tskill java >> ProcessKiller.bat
    echo start call runner >> ProcessKiller.bat
    echo goto start >> ProcessKiller.bat
    echo java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server >> Runner.bat
    echo exit >> Runner.bat
    echo @echo off >> Autorestart.bat
    echo :start >> Autorestart.bat
    echo Start call "Runner.bat" >> Autorestart.bat
    echo call "ProcessKiller.bat" >> Autorestart.bat
    echo pause >> Autorestart.bat
    echo goto start >> Autorestart.bat
    goto donexd
    :min14
    del ProcessKiller.bat
    del Autorestart.bat
    del Runner.bat
    echo :start >> ProcessKiller.bat
    echo PING 1.1.1.1 -n 1 -w 840000 >> ProcessKiller.bat
    echo tskill java >> ProcessKiller.bat
    echo start call runner >> ProcessKiller.bat
    echo goto start >> ProcessKiller.bat
    echo java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server >> Runner.bat
    echo exit >> Runner.bat
    echo @echo off >> Autorestart.bat
    echo :start >> Autorestart.bat
    echo Start call "Runner.bat" >> Autorestart.bat
    echo call "ProcessKiller.bat" >> Autorestart.bat
    echo pause >> Autorestart.bat
    echo goto start >> Autorestart.bat
    goto donexd
    :min16
    del ProcessKiller.bat
    del Autorestart.bat
    del Runner.bat
    echo :start >> ProcessKiller.bat
    echo PING 1.1.1.1 -n 1 -w 960000 >> ProcessKiller.bat
    echo tskill java >> ProcessKiller.bat
    echo start call runner >> ProcessKiller.bat
    echo goto start >> ProcessKiller.bat
    echo java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server >> Runner.bat
    echo exit >> Runner.bat
    echo @echo off >> Autorestart.bat
    echo :start >> Autorestart.bat
    echo Start call "Runner.bat" >> Autorestart.bat
    echo call "ProcessKiller.bat" >> Autorestart.bat
    echo pause >> Autorestart.bat
    echo goto start >> Autorestart.bat
    goto donexd
    :min18
    del ProcessKiller.bat
    del Autorestart.bat
    del Runner.bat
    echo :start >> ProcessKiller.bat
    echo PING 1.1.1.1 -n 1 -w 1080000 >> ProcessKiller.bat
    echo tskill java >> ProcessKiller.bat
    echo start call runner >> ProcessKiller.bat
    echo goto start >> ProcessKiller.bat
    echo java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server >> Runner.bat
    echo exit >> Runner.bat
    echo @echo off >> Autorestart.bat
    echo :start >> Autorestart.bat
    echo Start call "Runner.bat" >> Autorestart.bat
    echo call "ProcessKiller.bat" >> Autorestart.bat
    echo pause >> Autorestart.bat
    echo goto start >> Autorestart.bat
    goto donexd
    :min20
    del ProcessKiller.bat
    del Autorestart.bat
    del Runner.bat
    echo :start >> ProcessKiller.bat
    echo PING 1.1.1.1 -n 1 -w 1200000 >> ProcessKiller.bat
    echo tskill java >> ProcessKiller.bat
    echo start call runner >> ProcessKiller.bat
    echo goto start >> ProcessKiller.bat
    echo java -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server >> Runner.bat
    echo exit >> Runner.bat
    echo @echo off >> Autorestart.bat
    echo :start >> Autorestart.bat
    echo Start call "Runner.bat" >> Autorestart.bat
    echo call "ProcessKiller.bat" >> Autorestart.bat
    echo pause >> Autorestart.bat
    echo goto start >> Autorestart.bat
    goto donexd
    :donexd
    echo :: Autorestart configuration is complete. Choose 'y' at the menu.
    pause
    cls
    goto aur
    goto main
    :cre
    cls
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    echo :: Thanks you for using irans's ultimate Serverbatch!
    echo ::
    echo :: Thanks to:
    echo :: iran4life
    echo ::
    echo :: And you, if you have decided to use this
    echo :: instead of a different serverbatch (compiler).
    echo :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    pause
    cls
    goto main
    for some reason when i compile it says note: stream.java uses or overrides depricated API
    recompile with XLINT:deprication for details
    is there any errors ?
    help plz ive been trying for weeks and i went to ur link and still couldnt find...
    Edited by: imascape on Nov 5, 2008 8:18 PM

Maybe you are looking for

  • Import/export to memory and global variables

    Hi, Im working on some functionality using import/export to memory. One of the statements is: import gf_memid_exit = g_exit_flag gf_memid_result = t352r from memory id 'ZREV_EXT'. Im using global variables to contain the cluster names. But this is no

  • Changing smart object file format

    I've got a great problem with the smart objects in my project: I imported some Images (no background) which had the file format 'png'. I just dragged and dropped the files into my current photoshop window. They got imported and then automtically conv

  • GUI hangs on multiThreaded desktop application

    Hello i have one application which is like eclipse editor, but it can open one file at one time.it directly read file from server machine open it on JTextPane on right side on the event on double click on JTree node on the left side like eclipse. som

  • EXS24 Instrument Editor - RIDE SUSTAIN

    In the EXS24 Instrument Editor (perhaps elsewhere; I haven't checked), when I record a ride cymbal, it sounds wrong/choppy unless I hold down the sustain pedal on the keyboard. But when I play back the track without the sustain pedal held down, it so

  • Query producing wrong no. of rows

    Hi, I have a query joining two tables:( I am giving the simpler version) select /*+ INDEX_COMBINE(ym_product) INDEX_COMBINE(ym_zone_def) ym_product.product_id, ym_zone_def.product_id from ym_product , ym_zone_def where ym_product.product_id = ym_zone