FAQ Database Discussion Community


Getting NoClassDefFoundError in Java

java,classpath
I am learning about classpath in java. I created a package called Geometry which is stored in C:\Java\ containing one file Point.java which contains the following code package Geometry; public class Point { double x; double y; public Point(double xVal, double yVal) { x = xVal; y = yVal; }...

How do I print the current classpath for a Jenkins plugin?

java,jenkins,classpath,classloader
I'm developing a Jenkins plugin but I'm having a few problems which I think might be due to a jar missing in the plugin's classpath even though its in the plugin's WEB-INF/lib directory. Normally I would use the following code in Java to print the classpath but this doesn't seem...

Iterating through all JDK classes

java,reflection,classpath
I'm making a code editor and I'm working on the autocomplete. I want to programmatically get a list of all the classes that come with the JDK. Examples include: java.io.File java.util.ArrayList javax.swing.Action I've found ways to get classes for a specific package. For instance, I can get all classes that...

Wildfly 8 - Multiple EAR - ClassCastException

jpa,jboss,classpath,classcastexception,wildfly-8
I've been trying to fix an issue for some time now. I have two EAR files being deployed to Wildfly 8.1.0 with the same EJB.jar and the same JPA.jar, but with seperate EJB.jars for 'Scheduling' A.K.A running the different functions within the EJBs. The schedulers access the EJB.jars which in...

Hadoop Job class not found

java,eclipse,hadoop,mapreduce,classpath
Hi I'm having trouble and I haven't been able to get help yet from similar threads. I am doing an example of a hadoop job and I'm just trying to run it from the IDE right now. Here is my source code package org.myorg; import java.io.IOException; import java.util.*; import org.apache.hadoop.io.*;...

Absolute filesystem path for an IClasspathEntry

java,eclipse,classpath,jdt
I have an IJavaProject, and my goal is to generate a List<File> with the absolute filesystem paths for the resolved classpath entries for the project. I start by calling project.getResolvedClasspath(true) to get an array of IClasspathEntry objects. But I'm not sure how to reliably determine the absolute filesystem path for...

class not found exception in eclipse even though the user library containg jar file is in java build path

java,eclipse,jar,classpath,buildpath
I have created a dynamic web project. A user library with a jar file is also created. Then the user library has been added to the build path via project properties--->java build path--->In libraries tab required user library has added and jar file is specified under it. But exporting the...

NoClassDefFound means that the class cannot be found?

java,netbeans,classpath,packages,noclassdeffounderror
I don't understand NoClassDefFoundError in the context of running an OpenEJB client: [email protected]:~$ [email protected]:~$ java -classpath .:NetBeansProjects/HelloClient/dist/HelloClient.jar:apache-openejb-4.7.1/lib/openejb-client-4.7.1.jar org.acme.HelloClient Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBHome The missing class, EJBHome, is in the libray for the project: Yet doesn't show up in the manifest. How do I either force NetBeans to add...

NoClassDefFoundError with Kryo

java,serialization,classpath,kryo
I am looking for Kryo custom Serialization and De serialization example. How to check the the correctness of the Kryo read and write function. I have written some code to check, but it return exception. Any help would be appreciable. Thanks in advance. import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.KryoSerializable; import com.esotericsoftware.kryo.Serializer; import...

Running multiple Java classes

java,compilation,classpath,javac
I am trying to run a code with multiple Java class files and a jar file which is from a library I downloaded. I compiled them with the following: javac -cp "quickfixj-all-.jar" BTCCMarketDataRequest.java Bot.java The Bot class has the main method and the BTCCMarketDataRequest file has a bunch of other...

How to set external folders in classpath through command line while starting wildfly server

jboss,classpath,jboss7.x,wildfly,wildfly-8
I want to set external folders in classpath through command line while starting wildfly server. Unable to set it through -p standalone.sh -p path of folder ...

Getting ClassNotFound for PaxExam Option class when running test

java,osgi,classpath,pax-exam
When running unit tests with PaxExam I'm getting this ClassNotFoundException: java.lang.ClassNotFoundException: org.ops4j.pax.exam.Option at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) at...

Derby, Java: Trouble with “CREATE_TYPE” statement

java,eclipse,types,classpath,derby
I've been messing around with Apache Derby inside Eclipse. I've booted up a Network Server, and I've been working with servlets. In my Eclipse project, I have a class called "User", inside the package "base.pack". I have an SQL script open, and I've been trying to convert User, which implements...

Jar in the classpath

java,jar,classpath
Is there a programmatically way to get the complete list of all jar in the classpath ? I need that because we have behavior differences between two platforms. One is managed by us, but the other is not and i need to know if there is or not the same...

Java: Error: Could not find or load main class

java,classpath
I am trying to call Java code from an executable. My Java code is as follows: CostCalculatorType.java: public interface CostCalculatorType { public double calculateCost(double[] chromosome); } Main.java: import org.plyjy.factory.JythonObjectFactory; public class Main { public static void main(String[] args) { double[] a = new double[]{1.3653333, 0.0000000, -1.8204444, -1.8204444}; double result; JythonObjectFactory...

Running a JAVA project with external jars folder

java,jar,classpath
I'm trying to execute my JAVA app on a Linux OS where the necessary jars are located in a different folder. How can I execute my project using the external jars? project location: $ pwd /root/MyApp/bin $ ls Deletion.class jars location: /opt/jars/*.jar My failed execution: $ java Deletion ... NoClassDefFoundError...

How to specify “pig-0.13.0-h2.jar” dependency in build.gradle?

java,maven,gradle,classpath,apache-pig
To specify a Maven dependency in my project, I provide a name, a group id, and a version. This has been enough for every dependency in my project, save one. Pig has multiple jars in the same artifact (not sure if I have the proper nomenclature; I'm still rather new...

JavaFX getResource return null when running in browser

java,javafx,javafx-2,classpath,getresource
I have a javafx application and I store all fxml files in src/foo/bar/fxui folder. I use the code below to refer to fxml file: FXMLLoader loader = new FXMLLoader(getClass().getResource("/foo/bar/fxui/file.fxml")); Parent root = (Parent) loader.load(); The calling class is in src/foo/bar. This code works well when I run it in Eclipse....

Another Java classpath issue

java,classpath
I used Maven shade plugin to build the executable jar, which works fine when it include the properties in the build. But when I tried to move properties out to a separate folder, it failed with java.io.FileNotFoundException: class path resource [app.properties] cannot be opened because it does not exist. I...

Where is Java CLASSPATH in OSX?

java,osx,classpath
I have this file in my Home Directory on OSX: public class TestClass { public static void main(String[] args){ System.out.println("Hello World"); } } and in Bash I am running: Korays-MacBook-Pro:~ koraytugay$ javac TestClass.java Korays-MacBook-Pro:~ koraytugay$ java TestClass Hello World But I am wondering how the virtual machine instance running loads...

Where to put file that a jar needs to load

java,jar,classpath
I have a jar that will be connecting to a website for communication using websockets. The website is an SSL site and for that reason I have a .ts the program needs to load file. The following is the java code used to load that .ts file System.setProperty("javax.net.ssl.trustStore", "foo.ts"); System.setProperty("javax.net.ssl.trustStorePassword",...

Can't access resources folder in Java

java,gradle,resources,classpath,classloader
I tried to access resources (marked as) folder in Java app but nothing works, returns wrong paths I've tried: ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); System.out.println(classLoader.getResource(".")); and ClassLoader classLoader = Config.class.getClassLoader(); System.out.println(classLoader.getResource(".")); but it shows me file:/D:/testProject/build/classes/main/, and of course there's no resource files :( How to access exactly resources folder? -TestProject...

Fail to load ExtractingRequestHandler when running the Solr Quickstart Tutorial

solr,classpath
I installed Solr 5.0.0 on OS X 10.10.2 using Homebrew. I am trying to follow the quick start instructions and am getting errors when I try to index a directory of files. I am able to successfully start the sample Solr server by running bin/solr start -e cloud -noprompt as...

Spring RestTemplate dependency issue in Ear

spring,classpath,resttemplate,skinny-war
The organisation I work for has a few standalone services using Spring Boot and RestTemplate to communicate with each other and the main monolith (classical skinny War in Ear). However, we are running into problems with the classpath when we try to get RestTemplate running inside the Ear, but not...

Matlab: How to use javaaddpath dynamically

java,matlab,classpath
I want to use javaaddpath with different path to be added on my linux and window computer. However, I want it to be true dynamic allocation. In other words, user can define his/her own Path_Str = ' ....../ParforProgMonv2/java' and pass it at this step: pctRunOnAll javaaddpath (Path_Str) After opening matlab...

Java program with referenced libraries: NoClassDefFound [duplicate]

java,jar,terminal,classpath,command-line-interface
This question already has an answer here: NoClassDefFound when trying to run java with external libraries 4 answers How do I run a program in Java, with several referenced libraries, .jar files, from a command line? I have put all my .jars in /lib folder, which is in the...

How do I load the ChromeDriver binary from the classpath?

java,webdriver,classpath,selenium-chromedriver
A number of sources make reference to loading the ChromeDriver binary from the classpath, but I haven't worked out how to do it if the binary is not in the classpath root. To specify the path for the binary it seems that you have to set a system property "webdriver.chrome.driver"....

Java “-cp” option, compile time or runtime?

java,classpath
I see people saying there are different types of classpaths. for example compile time classpath and runtime classpath. I guess the "-cp" or "-classpath" option when used with javac is compile time classpath. and when used with java command it should be the runtime classpath. Am I correct? Can these...

Importtsv command gives : Container exited with a non-zero exit code 1 error

hadoop,hbase,classpath,yarn
I am trying to load a tsv file into an existing hbase table. I am using the following command: /usr/local/hbase/bin$ hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns=HBASE_ROW_KEY,cf:value '-Dtable_name.separator=\t' Table-name /hdfs-path-to-input-file But when I execute the above command, I get the following error Container id: container_1434304449478_0018_02_000001 Exit code: 1 Stack trace: ExitCodeException exitCode=1: at org.apache.hadoop.util.Shell.runCommand(Shell.java:538)...

Testing code dependant on existence of class on classpath

java,unit-testing,maven,classpath
I have a project where I need to provide SLF4J logging if SLF4J is on the classpath and otherwise provide logging straight to the console. I instantiate my logger with code similar to: try { Class.forName("org.slf4j.LoggerFactory"); return new Slf4JLogProvider(); } catch (ClassNotFoundException e) { System.out.println("SLF4J not on classpath, defaulting to...

NoClassDefFoundError Eclipse

java,eclipse,exception,classpath
I'm currently doing a plugin development for Eclipse and had to add jar files recently. Therefore I created a folder named "ext jars" and put all of them into it (also adding them to buildpath). Compiles fine but after running it throws a NoClassDefFoundError exception. could the reason be my...

How to read properties file inside jar?

java,jar,classpath
I have a config.properties file under the package com.abc.properties. From one of the java class present in com.abc.util, I need to read the property file. Both the files are present inside jar. I have tried using fs = new FileInputstream(VerifyFolderStructure.class.getResourceAsStream("com/abc/properties/config.properties")); But it doesn't seem to work. Please help. P.S: VerifyFolderStructure...

Adding an xml to java classpath in UNIX

java,unix,classpath
We know that we use the below for setting classpath for java execution from UNIX. This will work for ading all the jar files to classpath. java -cp ..jars/* MainClass But if I want to add an xml file to classpath, what should I do? I tried the below and...

Adding .jar files to classpath not allowing full use of library in Seaglass L&F

java,classpath,seaglass
I have been working on a GUI bit where I would like to play around with another Look and Feel. I have downloaded the Seaglass L&F .jars here: https://seaglass.googlecode.com/svn/doc/downloads.html I have added the dependency to my classpath as such when building: ...>javac -classpath C:\...\Metro\seaglasslookandfeel-0.2.jar Metro.java And then ran it with...

Load resource file outside jar

web-applications,jar,classpath,classloader,web-inf
I have created a jar which contains a class that loads an external resource file from class path of my web application. My application is running on resin server. I have deployed my jar in web-inf/lib and my resource file is in web-inf/classes folder. Now the resource file is being...

Bash compiling Java classes and JARs

java,bash,unix,classpath,javac
I am attempting to write a script that will automate a few tasks that I do regularly. The folder structure of my files is like so: ./ sampleScript.sh src/SampleProgram.java In addition to this, my Java program relies on the ojdbc6.jar file, which resides in ~/sampleFolder/lib. I have attempted to compile...

No resource found that matches the given name 'Theme.AppCompat.Light'. Android Studio

java,android,android-studio,classpath
I've downloaded Android Studio project from git, imported it to Android Studio but I can't run it. I always get this error Error:(7, -1) android-apt-compiler: [agent-stats-android] C:\Users\user\workspace\agent-stats-android\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. I've tried to add these files to libs...

Getting NoClassDefFoundError while using JGit in eclipse luna

java,jar,classpath,eclipse-luna
I recently download eclipse luna and installed the EGit plugin through Eclipse. I can see the download jar files in eclipse/plugins folder. I then added the JGit jar file to my build path and I can see the class files inside my Referenced Libraries folder. However, when I run the...

where is weblogic.Server class?

java,jar,weblogic,classpath
i'm installed weblogic server from wls1213_devzip_update1.zip on windows and create instance in domain in my own directory and it work fine. i'm try to install it on linux mint 17.1 kde x64 and it work fine when i'm install instance in domain by default, but i got error when i'll...

Custom classloader trouble with getResources for names ENDING in slash

java,classpath,classloader,urlclassloader,dynamic-class-loaders
I am desperate for help but was unable to find anything on the web about this particular subject (many related ones that leave my particular problem unanswered). Specifically, I need to be able to download code (jars) from a central and external code repository. This is done by the bootstrap...

eclipse can't find main class

java,eclipse,classpath,main
I am working on a project requiring using the Picasso Query Optimizer Analysis Tools, I am trying to configure the java source files onto eclipse EE Luna. However, I kept getting the error message that: Error: Could not find or load main class iisc.dsl.picasso.server.Picasso_Server. I tried the methods mentioned online...

Use JSON as a Scripted Data Set in Birt

json,eclipse,classpath,reporting,birt
I'm trying birt to generate report from a JSON Data . I followed this tutorial : http://blogs.actuate.com/use-json-as-a-scripted-data-set/ And i have done all steps but when i click on Data Set --> Edit --> Preview Results ; i got nothing . I suspect that i didn't include correctly apache commons library,...

java.lang.NoClassDefFoundError while deploying the War in websphere which uses Couchbase cache

java,websphere,classpath,ibm,noclassdeffounderror
I am facing the below error while deploying the war file in Websphere-8.5.5 Caused by: java.lang.NoClassDefFoundError: org/apache/http/params/SyncBasicHttpParams at com.couchbase.client.ViewConnection.createConnections(ViewConnection.java:120) at com.couchbase.client.ViewConnection.<init>(ViewConnection.java:100) at com.couchbase.client.CouchbaseConnectionFactory.createViewConnection(CouchbaseConnectionFactory.java:184) at com.couchbase.client.CouchbaseClient.<init>(CouchbaseClient.java:247) at...

Why doesn't java honour the class path when executing a jar file with the -jar switch?

java,jar,classpath,rxtx
This works: $ java -cp ".:/PATH/TO/RXTXcomm.jar:./jobexftp.jar" -Djava.library.path=/usr/lib/jni com.lhf.jobexftp.StandAloneApp JObexFTP 2.0 beta (15/10/2010) Java Obex File Transfer Protocol application and library Developed under/using 100% free software. For more information access: http://www.lhf.ind.br/jobexftp/ Usage: jobexftp <serialPort> [<commands>] [<options>] ... This doesn't: $ java -cp ".:/PATH/TO/RXTXcomm.jar" -Djava.library.path=/usr/lib/jni -jar jobexftp.jar Error: A JNI error has...

Sedgewick - Algorithms 4 Libraries

java,ubuntu,classpath
I'm trying to use the algs4 libraries for the Sedgewick's book Algorithms 4 and the things aren't working. I think I'm following correctly the guide from the website http://algs4.cs.princeton.edu/code/. I saved the files stdlib.jar and algs4.jar in the directory ~/algs4 and append the line "export CLASSPATH=$CLASSPATH:~/algs4/stdlib.jar:~/algs4/algs4.jar" in the ~/.profile file....

Ant Script for running Java file with class path

java,ant,classpath
I would like to simplify my life of running a Java file using a script. I think Ant script may work. Each time I want to run my program (in Unix System), I have to write the following command java -classpath ".:someclass" MyFile Or if the user is using Windows:...

Using external class files in a package

java,package,classpath,javac
I have a program that uses an external library called JHelper located in a neighboring folder home |--lib | |--JHelper.java | `--JHelper.class `--prj `--HelloWorld.java The HelloWorld.java file //package prj public class HelloWorld { public static void main(String[] args) { String echoed = JHelper.echo("Hello World"); System.out.println(echoed); } } I can compile...

Java classpath command line with opencsv writer

java,classpath,opencsv
How to include all jar files in Java? I'm using command prompt. My jar files is stored on C:\test\java jarfiles is: commons-io.jar, commons-lang.jar, opencsv.jar And my java program is also stored on C:\test\java I've searched on google but it seems I cannot find the proper way of using classpath. I'm...

Running JAR file from terminal (Runtime.getRuntime().exec) with both native and .jar dependencies

java,linux,jar,path,classpath
I am having trouble running a JAR file from terminal which has both native and .jar dependencies. Okay, my goal isn't to run it from the terminal, but to run it as a separate process with Java's Runtime.getRuntime().exec function, but if I can't run it from the terminal, then I...

#java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester

java,classpath,apache-commons-digester
I am getting java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester error and I am stuck with this error for more than a month. I have tried all Digester versions available and I also checked for duplicate JARs in classpath. I have designed the report through iReport-5.6.0 and I used the JARs from the iReport-5.6.0\ireport\modules\ext and...

Eclipse JDT class ASTVisitor not found

java,eclipse,classpath,jdt,eclipse-jdt
Consider the following code: // App.java import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import org.eclipse.jdt.core.dom.SimpleName; public class App { public static void main(String[] args) { ASTVisitor visitor = new ASTVisitor() { public boolean visit(VariableDeclarationFragment node) { return false; } public boolean visit(SimpleName node) { return false; } }; } } compiled successfully with:...

Apache Storm application fails at run

java,maven,classpath
I am encountering a problem at runtime, when my application can't find classes listed in maven as dependencies at compile. The application compiles without issue. The application is as follows package com.ender.storm; import backtype.storm.Config; import backtype.storm.LocalCluster; import backtype.storm.topology.TopologyBuilder; public class HelloStorm { public static void main(String[] args) throws Exception{ Config...

How to add an external library (OpenCV .jar file) to the Java build path from the command line (Unix)

java,unix,opencv,terminal,classpath
I am trying to add the OpenCV library to the build path for my Java program from the terminal so that I can use a shell script to run the program on a bunch of image files sequentially. The .class files for my project are located in Documents/Programming/Ko/bin and the...

Scala classpath not finding default package class in local directory

scala,classpath
Consider a v simple scala object with the following first two lines (default/no package) and a main(): object CpuTest { def main(args: Array[String]) = { .. Compiling works fine [email protected]:/shared/OpenChai/dstat$ scalac CpuTest.scala Here are the classes: [email protected]:/shared/OpenChai/dstat$ ls -l *.class -rw-rw-r-- 1 stephen stephen 1150 Jun 10 20:06 CpuTest$$anonfun$1.class -rw-rw-r--...

Making jar files available to the scala REPL

scala,classpath,artifact
I can't seem to get this to work, so i have tried what's probably the most straightforward case--ie, retrieve the jar file and into a given directory then start the scala REPL from that directory--still no luck. I know the jar files are fine and correctly references (eg, i can...

Setting classpath to use JSON simple

java,json,classpath,json-simple
I am trying to use the JSON simple library, but I just can'e execute my program with it. I am trying to compile this way: $ javac -classpath json.jar TestClass.java (json.rar is the json-simple file) And it compiles ok. But I'm having trouble running it. This is how I am...