Example usage for java.lang ClassNotFoundException printStackTrace

List of usage examples for java.lang ClassNotFoundException printStackTrace

Introduction

In this page you can find the example usage for java.lang ClassNotFoundException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:my.yelp.populate.java

public Connection getConnection() {
    String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
    String DB_URL = "jdbc:mysql://localhost/";

    Statement stmt = null;// w w  w  .ja va2 s  .  c om
    String user = "vishrutshah15";
    String password = "Rutva1526#";
    String port = "1521";
    String DBname = "SYSTEM";
    try {
        Class.forName("oracle.jdbc.driver.OracleDriver");
    } catch (ClassNotFoundException e) {
        System.out.println("Connection failed!" + e);
        return null;
    }
    try {
        //System.out.println("Connecting to database...");
        conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", user, password);
        //System.out.println("Creating database...");
        System.out.println("Database created successfully...");
        return conn;
        //                      

    } catch (SQLException se) {
        System.out.println("Connection failed!" + se);
        se.printStackTrace();
    } catch (Exception e) {

        e.printStackTrace();

    }
    return null;
}

From source file:Connexion.ChartDocteur.java

public ChartDocteur() {

    try {//w  w w .  j ava2s  . c  om
        Class.forName("com.mysql.jdbc.Driver");
    } catch (ClassNotFoundException e) {
        /* Grer les ventuelles erreurs ici. */
    }
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    int f = 0;
    int g = 0;
    try {
        ResultSet resultat1 = this.connect
                .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
                .executeQuery("SELECT specialite FROM docteur WHERE specialite =  'Cardiologue'");
        // on rcupre le nombre de lignes de la requte
        if (resultat1.last()) {
            a = resultat1.getRow();
        }
        System.out.println(a);

    } catch (SQLException e) {
        e.printStackTrace();
    }
    try {
        ResultSet resultat2 = this.connect
                .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
                .executeQuery("SELECT specialite FROM docteur WHERE specialite =  'Traumatologue'");
        // on rcupre le nombre de lignes de la requte
        if (resultat2.last()) {
            b = resultat2.getRow();
        }
        System.out.println(b);

    } catch (SQLException e) {
        e.printStackTrace();
    }
    try {

        ResultSet resultat3 = this.connect
                .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
                .executeQuery("SELECT specialite FROM docteur WHERE specialite =  'Pneumologue'");
        // on rcupre le nombre de lignes de la requte
        if (resultat3.last()) {
            c = resultat3.getRow();
        }
        System.out.println(c);

    } catch (SQLException e) {
        e.printStackTrace();
    }

    try {

        ResultSet resultat4 = this.connect
                .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
                .executeQuery("SELECT specialite FROM docteur WHERE specialite =  'Orthopediste'");
        // on rcupre le nombre de lignes de la requte
        if (resultat4.last()) {
            d = resultat4.getRow();
        }
        System.out.println(d);

    } catch (SQLException e) {
        e.printStackTrace();
    }

    try {

        ResultSet resultat5 = this.connect
                .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
                .executeQuery("SELECT specialite FROM docteur WHERE specialite =  'Radiologue'");
        // on rcupre le nombre de lignes de la requte
        if (resultat5.last()) {
            f = resultat5.getRow();
        }
        System.out.println(f);

    } catch (SQLException e) {
        e.printStackTrace();
    }

    try {

        ResultSet resultat6 = this.connect
                .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE)
                .executeQuery("SELECT specialite FROM docteur WHERE specialite =  'Anesthesiste'");
        // on rcupre le nombre de lignes de la requte
        if (resultat6.last()) {
            g = resultat6.getRow();
        }
        System.out.println(g);

    } catch (SQLException e) {
        e.printStackTrace();
    }
    DefaultPieDataset union = new DefaultPieDataset();

    //remplir l'ensemble

    union.setValue("Cardiologue", a);
    union.setValue("Traumatologue", b);
    union.setValue("Pneumologue", c);
    union.setValue("Orthopediste", d);
    union.setValue("Radiologue", f);
    union.setValue("Anesthesiste", g);

    JFreeChart repart = ChartFactory.createPieChart3D("Nombre de mdecin par spcialit", union, true, true,
            false);
    ChartPanel crepart = new ChartPanel(repart);
    this.add(crepart);
    this.pack();
    this.setVisible(true);
}

From source file:at.ac.tuwien.auto.iotsys.gateway.connectors.knx.KNXDeviceLoaderETSImpl.java

private void parseEntites(KNXConnector knxConnector, ObjectBroker objectBroker,
        Hashtable<String, EntityImpl> entityById, Hashtable<String, DatapointImpl> datapointById, NetworkImpl n,
        Hashtable<String, String> resourceById, Hashtable<String, String> groupAddressByDatapointID,
        boolean enableGroupComm, boolean enableHistories) {
    for (int entityIdx = 0; entityIdx < sizeOfConfiguration(
            devicesConfig.getProperty("entities.entity[@id]")); entityIdx++) {
        // Entity
        HierarchicalConfiguration entityConfig = devicesConfig
                .configurationAt("entities.entity(" + entityIdx + ")");

        String entityId = entityConfig.getString("[@id]");
        String entityName = arrayToString(entityConfig.getStringArray("[@name]"));
        String entityDescription = arrayToString(entityConfig.getStringArray("[@description]"));
        String entityOrderNumber = entityConfig.getString("[@orderNumber]");
        String entityManufacturerId = entityConfig.getString("[@manufacturerId]");

        EntityImpl entity = new EntityImpl(entityId, entityName, entityDescription,
                resourceById.get(entityManufacturerId), entityOrderNumber);
        entityById.put(entityId, entity);
        n.getEntities().addEntity(entity);
        objectBroker.addObj(entity, true);

        // Translations
        for (int transIdx = 0; transIdx < sizeOfConfiguration(
                entityConfig.getProperty("translations.translation[@language]")); transIdx++) {
            HierarchicalConfiguration transConfig = entityConfig
                    .configurationAt("translations.translation(" + transIdx + ")");

            String language = transConfig.getString("[@language]");
            String attribute = transConfig.getString("[@attribute]");
            String value = arrayToString(transConfig.getStringArray("[@value]"));

            try {
                entity.addTranslation(language, attribute, value);
            } catch (Exception e) {
                log.warning(e.getMessage());
            }//  w ww.  j  a  va  2  s  .  c o  m
        }

        // DPs
        for (int datapointIdx = 0; datapointIdx < sizeOfConfiguration(
                entityConfig.getProperty("datapoints.datapoint[@id]")); datapointIdx++) {
            HierarchicalConfiguration datapointConfig = entityConfig
                    .configurationAt("datapoints.datapoint(" + datapointIdx + ")");

            String dataPointName = arrayToString(datapointConfig.getStringArray("[@name]"));
            String dataPointTypeIds = datapointConfig.getString("[@datapointTypeIds]");
            String dataPointId = datapointConfig.getString("[@id]");
            String dataPointDescription = arrayToString(datapointConfig.getStringArray("[@description]"));
            String dataPointWriteFlag = datapointConfig.getString("[@writeFlag]");
            String dataPointReadFlag = datapointConfig.getString("[@readFlag]");
            // String dataPointPriority = datapointConfig.getString("[@priority]");
            // String dataPointCommunicationFlag = datapointConfig.getString("[@communicationFlag]");
            // String dataPointReadOnInitFlag = datapointConfig.getString("[@readOnInitFlag]");
            // String dataPointTransmitFlag = datapointConfig.getString("[@transmitFlag]");
            // String updateFlag = datapointConfig.getString("[@updateFlag]");

            // use only the first DPTS
            if (dataPointTypeIds.indexOf(" ") >= 0) {
                dataPointTypeIds = dataPointTypeIds.substring(0, dataPointTypeIds.indexOf(" "));
            }

            log.info("Found data point type id: " + dataPointTypeIds);
            String clazzName = "at.ac.tuwien.auto.iotsys.gateway.obix.objects.knx.datapoint.impl."
                    + dataPointTypeIds.replace('-', '_') + "_ImplKnx";
            Class<?> clazz = null;

            try {
                log.info("Loading: " + clazzName);
                clazz = Class.forName(clazzName);
            } catch (ClassNotFoundException e) {
                log.warning(clazzName
                        + " not found. Cannot instantiate according sub data point type. Trying fallback to generic main type.");
                int firstIndexOf = dataPointTypeIds.indexOf('-');
                int secondIndexOf = dataPointTypeIds.indexOf('-', firstIndexOf + 1);
                clazzName = "at.ac.tuwien.auto.iotsys.gateway.obix.objects.knx.datapoint.impl." + "DPT_"
                        + dataPointTypeIds.substring(firstIndexOf + 1, secondIndexOf) + "_ImplKnx"; //

                try {
                    log.info("Loading: " + clazzName);
                    clazz = Class.forName(clazzName);
                } catch (ClassNotFoundException e1) {
                    e1.printStackTrace();
                    log.warning(clazzName + " not found. Cannot instantiate according main data point type.");
                }
            }

            try {
                if (clazz != null) {
                    Constructor<?> constructor = clazz.getConstructor(KNXConnector.class, DataPointInit.class);
                    Object[] object = new Object[2];
                    object[0] = knxConnector;

                    DataPointInit dptInit = new DataPointInit();
                    dptInit.setDisplay(dataPointDescription);
                    dptInit.setDisplayName(dataPointName);
                    dptInit.setReadable(
                            EnumsImpl.getInstance().getEnum(EnumEnabled.HREF).getBool(dataPointReadFlag));
                    dptInit.setName(dataPointId);
                    dptInit.setGroupAddress(
                            new GroupAddress(Integer.parseInt(groupAddressByDatapointID.get(dataPointId))));
                    dptInit.setWritable(
                            EnumsImpl.getInstance().getEnum(EnumEnabled.HREF).getBool(dataPointWriteFlag));

                    object[1] = dptInit;
                    DatapointImpl dataPoint = (DatapointImpl) constructor.newInstance(object);

                    datapointById.put(dataPointId, dataPoint);
                    entity.addDatapoint(dataPoint);

                    if (enableGroupComm)
                        objectBroker.enableGroupComm(dataPoint);
                    if (enableHistories)
                        objectBroker.addHistoryToDatapoints(dataPoint);
                    objectBroker.addObj(dataPoint, true);

                    // Search for child "value"
                    Obj dpValue = dataPoint.get("value");
                    if (dpValue != null) {
                        dpValue.setDisplayName(dataPointDescription);
                    }

                    // Translations (DP)
                    for (int transIdx = 0; transIdx < sizeOfConfiguration(
                            datapointConfig.getProperty("translations.translation[@language]")); transIdx++) {
                        HierarchicalConfiguration transConfig = datapointConfig
                                .configurationAt("translations.translation(" + transIdx + ")");

                        String language = transConfig.getString("[@language]");
                        String attribute = transConfig.getString("[@attribute]");
                        String value = arrayToString(transConfig.getStringArray("[@value]"));

                        try {
                            dataPoint.addTranslation(language, attribute, value);

                            // translation for DisplayName of value
                            if (attribute.toLowerCase().trim().equals("description") && dpValue != null) {
                                dpValue.addTranslation(language, TranslationAttribute.displayName, value);
                            }
                        } catch (Exception e) {
                            log.warning(e.getMessage());
                        }
                    }
                }
            } catch (NoSuchMethodException e) {
                log.warning(clazzName + " no such method. Cannot instantiate according datapoint.");
            } catch (SecurityException e) {
                log.warning(clazzName + " security exception. Cannot instantiate according datapoint.");
            } catch (InstantiationException e) {
                log.warning(clazzName + " instantiation exception. Cannot instantiate according datapoint.");
            } catch (IllegalAccessException e) {
                log.warning(clazzName + " illegal access exception. Cannot instantiate according datapoint.");
            } catch (IllegalArgumentException e) {
                log.warning(clazzName + " illegal argument exception. Cannot instantiate according datapoint.");
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                log.warning(
                        clazzName + " invocation target exception. Cannot instantiate according datapoint.");
                e.printStackTrace();
            }
        }
    }
}

From source file:engine.resources.objects.Baseline.java

public void initializeChildren(Object delta) throws IllegalArgumentException, IllegalAccessException,
        InvocationTargetException, NoSuchMethodException, SecurityException {
    if (delta instanceof IDelta || delta instanceof SWGList || delta instanceof SWGMap
            || delta instanceof SWGMultiMap || delta instanceof SWGSet) {
        delta.getClass().getMethod("init", new Class[] { SWGObject.class }).invoke(delta,
                new Object[] { object });

        Class<?> iDelta = null;

        try {//from   w ww . j  a va2 s .  co m
            iDelta = Class.forName("engine.resources.objects.IDelta");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            return;
        }

        for (Field field : delta.getClass().getFields()) {
            if (iDelta.isInstance(field.get(delta))) {
                initializeChildren(field.get(delta));
            }
        }
    }
}

From source file:de.unisb.cs.st.javalanche.mutation.runtime.testDriver.MutationTestDriver.java

/**
 * Adds a {@link MutationTestListener} from a property. Multiple listeners
 * are sperated by commas.//from   ww w.  j  av a 2s.  c o m
 */
@SuppressWarnings("unchecked")
private void addListenersFromProperty() {
    String listenerString = System.getProperty(MUTATION_TEST_LISTENER_KEY);
    if (listenerString != null) {
        String[] split = listenerString.split(",");
        for (String listenerName : split) {
            logger.info("Trying to add mutation test listener: " + listenerName);
            try {
                Class<? extends MutationTestListener> clazz = (Class<? extends MutationTestListener>) Class
                        .forName(listenerName);
                MutationTestListener listenerInstance = clazz.newInstance();
                addMutationTestListener(listenerInstance);
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
}

From source file:org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.java

/**
 * WARNING: This method relies on having access to the same repository
 * URLs as the server uses./*  ww w  .  ja v  a 2  s.com*/
 *
 * @param request portlet request
 * @param data    info about jars to include
 * @return driver class
 */
private static Class attemptDriverLoad(PortletRequest request, PoolData data) {
    List<URL> list = new ArrayList<URL>();
    try {
        String[] jars = data.getJars();
        if (jars == null) {
            log.error("Driver load failed since no jar files were selected.");
            return null;
        }
        ListableRepository[] repos = PortletManager.getCurrentServer(request).getRepositories();

        for (String jar : jars) {
            Artifact artifact = Artifact.create(jar);
            for (ListableRepository repo : repos) {
                File url = repo.getLocation(artifact);
                if (url != null) {
                    list.add(url.toURI().toURL());
                }
            }
        }
        URLClassLoader loader = new URLClassLoader(list.toArray(new URL[list.size()]),
                DatabasePoolPortlet.class.getClassLoader());
        try {
            return loader.loadClass(data.driverClass);
        } catch (ClassNotFoundException e) {
            return null;
        }
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.vk.sdk.payments.VKIInAppBillingService.java

/**
 * Method for save transaction if you can't use
 * VKIInAppBillingService mService = new VKIInAppBillingService(IInAppBillingService.Stub.asInterface(service));
 * WARNING!!! this method must call before consume google and is it returned true
 *
 * @param apiVersion - version google apis
 * @param purchaseToken - purchase token
 * @return true is send is ok/*  w  ww.j  a va2 s .c  o m*/
 * @throws android.os.RemoteException
 */
public static boolean consumePurchaseToVk(final int apiVersion, @NonNull final String purchaseToken)
        throws android.os.RemoteException {
    if (Looper.getMainLooper().equals(Looper.myLooper())) {
        throw new RuntimeException("Network on main thread");
    }
    final Context ctx = VKUIHelper.getApplicationContext();
    if (ctx == null) {
        return false;
    }

    final PurchaseData purchaseData = new PurchaseData();

    if (!VKPaymentsServerSender.isNotVkUser()) {
        final SyncServiceConnection serviceConnection = new SyncServiceConnection() {
            @Override
            public void onServiceConnectedImpl(ComponentName name, IBinder service) {
                Object iInAppBillingService = null;

                final Class<?> iInAppBillingServiceClassStub;
                try {
                    iInAppBillingServiceClassStub = Class
                            .forName("com.android.vending.billing.IInAppBillingService$Stub");
                    Method asInterface = iInAppBillingServiceClassStub.getMethod("asInterface",
                            android.os.IBinder.class);
                    iInAppBillingService = asInterface.invoke(iInAppBillingServiceClassStub, service);
                } catch (ClassNotFoundException e) {
                    throw new RuntimeException(PARAMS_ARE_NOT_VALID_ERROR);
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }

                try {
                    purchaseData.purchaseData = getPurchaseData(iInAppBillingService, apiVersion,
                            ctx.getPackageName(), purchaseToken);
                } catch (Exception e) {
                    Log.e("VKSDK", "error", e);
                    purchaseData.hasError = true;
                }
            }

            @Override
            public void onServiceDisconnectedImpl(ComponentName name) {

            }
        };

        Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
        serviceIntent.setPackage("com.android.vending");
        if (!ctx.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
            // bind
            ctx.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE);
            // wait bind
            synchronized (serviceConnection.syncObj) {
                while (!serviceConnection.isFinish) {
                    try {
                        serviceConnection.syncObj.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
            // unbind
            ctx.unbindService(serviceConnection);
        } else {
            return false;
        }
    } else {
        return true;
    }

    if (purchaseData.hasError) {
        return false;
    } else if (!TextUtils.isEmpty(purchaseData.purchaseData)) {
        VKPaymentsServerSender.getInstance(ctx).saveTransaction(purchaseData.purchaseData);
    }

    return true;
}

From source file:com.thoughtworks.selenium.SeleneseTestNgHelperVir.java

/**
 * Reportresult.// ww w  .  j av  a2s  .c  o  m
 * 
 * @param isAssert
 *            the is assert
 * @param step
 *            the step
 * @param result
 *            the result
 * @param messageString
 *            the message string
 */
public final void reportresult(final boolean isAssert, final String step, final String result,
        final String messageString) {
    String message = messageString;

    StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
    callingClassName = stackTraceElements[0].getClassName().toString().toString();
    String callingMethod = "";
    // System.out.println("-----superman-----");
    for (int i = 0; i < stackTraceElements.length; i++) {
        callingClassName = stackTraceElements[i].getClassName().toString();
        if (callingClassName.startsWith(testPackageName)) {
            callingMethod = stackTraceElements[i].getMethodName();
            lineNumber = stackTraceElements[i].getLineNumber();
            break;
        }
    }
    System.out.println(callingClassName);
    // System.out.println("-----superman-----");
    Class callingClass = null;
    try {
        callingClass = Class.forName(callingClassName);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    getLogger(callingClass);
    if (!currentMethod.equals(callingMethod)) {
        getLog().info("Executing : " + callingClass.getName() + " : " + callingMethod);
        currentMethod = callingMethod;
    }

    getLog().info("Step : " + step + "\t|\tResult : " + result + "\t|\tMessage : " + message);

    logTime(step, getCommandStartTime(), getCurrentTime(), getLog());

    reporter.reportResult(step, result, message);

    // Adding data to the new reporter
    try {

        String testStep = step.substring(0, step.indexOf(":"));
        // replace xml special characters in the message.
        message = replaceXMLSpecialCharacters(message);
        if (result.equals("PASSED")) {
            String testMessage = message;
            if (message.equals("") || message == null) {
                testMessage = "Passed";
            }
            if (callingClassName.contains("LIBRARY_RECOVERY")) {
                resultReporter.reportStepResults(true, "RECOVERY : " + testStep, testMessage, "Success", "");
            } else {
                resultReporter.reportStepResults(true, testStep, testMessage, "Success", "");
            }
        } else {
            if (callingClassName.contains("LIBRARY_RECOVERY")) {
                resultReporter.reportStepResults(false, "RECOVERY : " + testStep, message, "Error",
                        getSourceLines(new Throwable(message).getStackTrace()));
            } else {
                resultReporter.reportStepResults(false, testStep, message, "Error",
                        getSourceLines(new Throwable(message).getStackTrace()));
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:gov.nih.nci.system.web.struts.action.RestQuery.java

protected String getQueryString(String className, String roleName, HttpServletRequest request) {

    StringBuilder sb = new StringBuilder();
    Enumeration<String> parameters = request.getParameterNames();

    Map<String, Map<String, List<Object>>> isoDataTypeNodes = new HashMap<String, Map<String, List<Object>>>();
    List<String> criteriaList = new ArrayList();
    while (parameters.hasMoreElements()) {
        String parameterName = (String) parameters.nextElement();
        log.debug("param = " + parameterName);
        if (!parameterName.equals("klassName") && !parameterName.equals("searchObj")
                && !parameterName.equals("BtnSearch") && !parameterName.equals("username")
                && !parameterName.equals("password") && !parameterName.equals("selectedDomain")) {
            String parameterValue = (request.getParameter(parameterName)).trim();
            if (parameterValue.length() > 0) {
                criteriaList.add(parameterName + "=" + parameterValue);
                /*/*from www  . j  ava2  s  .  c  om*/
                if (parameterName.indexOf('.') > 0) { // ISO data type
                                     // parameter
                   saveIsoNode(isoDataTypeNodes, parameterName,
                parameterValue);
                } else { // non-ISO data type parameter
                   criteriaList.add(parameterName + "=" + parameterValue);
                }*/
            }
        }
    }

    log.debug("criteriaList = " + criteriaList);
    if (criteriaList.size() > 0) {
        StringBuffer sb2 = new StringBuffer();
        for (String criteria : criteriaList) {
            sb2.append(criteria + ";");

        }
        String returnStr = sb2.toString();
        if (returnStr.endsWith(";"))
            returnStr = returnStr.substring(0, returnStr.length() - 1);

        if (roleName != null && roleName.trim().length() > 0)
            returnStr = returnStr + "/" + roleName;
        log.debug("returnStr = " + returnStr);
        return "search;" + returnStr;
    } else {
        try {
            log.debug("className = " + className);
            String colName = classCache.getClassIdName(Class.forName(className), true);
            log.debug("colName = " + colName);
            String returnStr = "search;" + colName + "=*";
            if (roleName != null && roleName.trim().length() > 0)
                returnStr = returnStr + "/" + roleName;
            return returnStr;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
    return null;
}

From source file:com.taiter.ce.Main.java

public static void makeLists(boolean finalize, boolean printSuccess) {
    long time = System.currentTimeMillis();

    // ------------Dynamic enchantment loading----------------------
    try {/*from   w ww .j av  a  2  s .  c  o  m*/
        String path = plugin.getDataFolder().getAbsolutePath();
        String classSource = Bukkit.getPluginManager().getPlugin("CustomEnchantments").getClass()
                .getProtectionDomain().getCodeSource().getLocation().getFile();
        String seperator = "\\\\";
        if (classSource.contains("/"))
            seperator = "/";
        String[] classSourceSplit = classSource.split(seperator);
        path = path.substring(0, path.length() - 18)
                + classSourceSplit[classSourceSplit.length - 1].replace("%20", " ");
        JarFile jar = new JarFile(path);
        Enumeration<JarEntry> entries = jar.entries();

        while (entries.hasMoreElements()) {
            String entryName = entries.nextElement().getName();
            if (!entryName.contains("$") && entryName.contains("Enchantments") && entryName.endsWith(".class")
                    && !(entryName.contains("CEnchantment") || entryName.contains("EnchantManager")
                            || entryName.contains("GlowEnchantment")))
                try {
                    Application app = null;
                    String className = entryName.replace(".class", "");

                    if (entryName.contains("/")) {
                        app = Application.valueOf(entryName.split("/")[4].toUpperCase());
                        className = className.replaceAll("/", ".");
                    } else if (entryName.contains("\\")) {
                        app = Application.valueOf(entryName.split("\\\\")[4].toUpperCase());
                        className = className.replaceAll("\\\\", ".");
                    }
                    EnchantManager.getEnchantments().add((CEnchantment) classLoader.loadClass(className)
                            .getDeclaredConstructor(Application.class).newInstance(app));
                } catch (ClassNotFoundException e) {
                } // Checked exception, should never be thrown
        }

        jar.close();
    } catch (Exception e) {
        if (e instanceof FileNotFoundException) {
            Bukkit.getConsoleSender()
                    .sendMessage(ChatColor.RED + "[CE] Custom Enchantments could not be started,");
            Bukkit.getConsoleSender()
                    .sendMessage(ChatColor.RED + "[CE] please make sure that you the plugins jar");
            Bukkit.getConsoleSender()
                    .sendMessage(ChatColor.RED + "[CE] in your plugin folder is named 'CustomEnchantments'.");
        } else {
            Bukkit.getConsoleSender()
                    .sendMessage(ChatColor.RED + "[CE] Custom Enchantments could not be loaded,");
            Bukkit.getConsoleSender().sendMessage(
                    ChatColor.RED + "[CE] please report this error on the Bukkit page of the plugin");
            Bukkit.getConsoleSender()
                    .sendMessage(ChatColor.RED + "[CE] by sending the following to Taiterio via PM:");
            e.printStackTrace();
        }
        plugin.getServer().getPluginManager().disablePlugin(plugin);
        return;
    }
    // --------------------------------------------------------------------------------

    if (finalize)
        for (CEnchantment ce : new HashSet<CEnchantment>(EnchantManager.getEnchantments()))
            ce.finalizeEnchantment();

    if (printSuccess)
        Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] All Enchantments have been loaded.");

    // ITEMS

    // Bow
    items.add(new Minigun("Minigun", ChatColor.AQUA, "Fires a Volley of Arrows", 0, Material.BOW));
    items.add(new BeastmastersBow("Beastmaster's Bow", ChatColor.AQUA,
            "Tame the wilderness;and turn nature against your foes!", 0, Material.BOW));
    items.add(
            new HookshotBow("Hookshot Bow", ChatColor.AQUA, "Everyone is just one hook away", 0, Material.BOW));

    // Boots
    items.add(new HermesBoots("Hermes Boots", ChatColor.GOLD, "These boots are made for walkin'", 100,
            Material.DIAMOND_BOOTS));
    items.add(new LivefireBoots("Livefire Boots", ChatColor.DARK_RED,
            "Leave a burning trail...;Because it's fun!", 0, Material.DIAMOND_BOOTS));
    items.add(new RocketBoots("Rocket Boots", ChatColor.AQUA,
            "Up we go!; ;WARNING: May cause dismemberment,;            death;            and explosions", 0,
            Material.DIAMOND_BOOTS));
    items.add(new DruidBoots("Druid Boots", ChatColor.DARK_GREEN, "Let the nature rejuvenate you!", 0,
            Material.DIAMOND_BOOTS));

    // Flint + Steel
    items.add(new Flamethrower("Flamethrower", ChatColor.DARK_RED, "Burn, baby, burn!", 0,
            Material.FLINT_AND_STEEL));

    // Stick
    items.add(new NecromancersStaff("Necromancer's Staff of Destruction", ChatColor.AQUA,
            "Wreak chaos everywhere,;Because why not?", 0, Material.STICK));

    // Armor
    // items.add((CItem) new Swimsuit("Scuba Helmet", ChatColor.BLUE, "Just
    // stay underwater for a while,;Take your time!", 60,
    // Material.IRON_HELMET));

    // Axe
    items.add(new ThorsAxe("Thor's Axe", ChatColor.GOLD,
            "Smite your enemies down with mighty thunder!;Note: Batteries not included.", 0,
            Material.DIAMOND_AXE));
    items.add(new Pyroaxe("Pyroaxe", ChatColor.DARK_RED,
            "Are your enemies burning?;Do you want to make their situation worse?;Then this is just perfect for you!",
            0, Material.DIAMOND_AXE));

    // Sword
    items.add(new AssassinsBlade("Assassin's Blade", ChatColor.AQUA,
            "Sneak up on your enemies and hit them hard!; ;(High chance of failure against Hacked Clients)",
            200, Material.GOLD_SWORD));

    // Shovel
    items.add(new HealingShovel("Healing Shovel", ChatColor.GREEN,
            "Smacking other people in the face;has never been healthier!", 600, Material.GOLD_SPADE));

    // Projectile
    items.add(new Firecracker("Firecracker", ChatColor.DARK_RED, "Makes every situation a good situation!", 0,
            Material.SNOW_BALL));

    // Block
    items.add(new FireworkBattery("Firework-Battery", ChatColor.DARK_RED,
            "Make the sky shine bright with colors!", 0, Material.REDSTONE_BLOCK));

    // Mines
    items.add(new BearTrap("Bear Trap", ChatColor.GRAY, "Just hope that it does not contain bears...", 0,
            Material.IRON_PLATE));
    items.add(
            new PiranhaTrap("Piranha Trap", ChatColor.GRAY, "Who came up with this?", 0, Material.WOOD_PLATE));
    items.add(new PoisonIvy("Poison Ivy", ChatColor.DARK_GREEN,
            "If you're too cheap to afford ladders,;just take this, it'll work just fine!", 0, Material.VINE));
    items.add(new PricklyBlock("Prickly Block", ChatColor.LIGHT_PURPLE,
            "Just build a labyrinth out of these,;people will love you for it!", 0, Material.SAND));
    items.add(new Landmine("Landmine", ChatColor.GRAY, "Just don't trigger it yourself, please.", 0,
            Material.GOLD_PLATE));

    // Any
    items.add(new Powergloves("Powergloves", ChatColor.AQUA, "Throw all your problems away!", 500,
            Material.QUARTZ));
    items.add(new Medikit("Medikit", ChatColor.GREEN,
            "Treats most of your ailments,;it even has a box of juice!", 2000, Material.NETHER_STALK));
    items.add(new Bandage("Bandage", ChatColor.GREEN, "It has little hearts on it,;so you know it's good", 1000,
            Material.PAPER));
    items.add(new Deathscythe("Deathscythe", ChatColor.DARK_GRAY, "An ancient evil lies within...", 400,
            Material.GOLD_HOE));
    items.add(new PotionLauncher("Potion Launcher", ChatColor.DARK_GRAY,
            "Instructions: Put potion into the righthand slot;                of the potion launcher,;                aim and fire!; ;Manufactured by "
                    + ChatColor.MAGIC + "Taiterio",
            20, Material.HOPPER));
    //

    if (finalize)
        for (CItem ci : items)
            ci.finalizeItem();

    if (printSuccess)
        Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] All Items have been loaded.");

    deleteInactive();

    if (printSuccess)
        if (Boolean.parseBoolean(Main.config.getString("Global.Logging.Enabled")))
            Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[CE] Took "
                    + (System.currentTimeMillis() - time) + "ms to initialize Custom Enchantments.");

}