Android Instrumentation Tests: 'Could not find test class' using Espresso and Spoon - java

I'm running my instrumentation tests using Espresso and Spoon. Here's a useful blog I have followed https://medium.com/android-bits/running-espresso-tests-on-multiple-devices-with-spoon-842a5546e3d7
Everything was OK before the deprecation of ActivityTestRule. Right now I have migrated to ActivityScenarioRule/ActivityScenario. The issue is that it keeps throwing me the error below.
at androidx.test.runner.MonitoringInstrumentation.runOnMainSync(MonitoringInstrumentation.java:450)
at androidx.test.core.app.ActivityScenario.onActivity(ActivityScenario.java:673)
at mypackage.test.MyActivityTest.validateMainView(MyActivityTest.java:41)
at java.lang.reflect.Method.invoke(Native Method)
...
Caused by: java.lang.IllegalArgumentException: Could not find test class!
Caused by: at mypackage.test.-$$Lambda$MyActivityTest$s-_.
AV2ffllNOI7pyo0DUVsTz8G4.perform(lambda)
Caused by: at androidx.test.core.app.ActivityScenario$$Lambda$4.run(Unknown Source)
The MyActivityTest.java:41 is where I have the
activityScenario.onActivity(activity -> Spoon.screenshot(activity, "Display-screen"));
The HTML reports are created but the tests are failing due to the said error. Has anyone experienced this and has solutions?

The Spoon has two screenshots methods, use the method which has 4 parameters(activity, tag, String testClassName, Strig testMethodName)
Example:
private final String testClassName = "MainActivityUITest";
private final String testMethodName = "inputFieldVerification";
activityScenario.onActivity(activity -> Spoon.screenshot(activity, "Display-screen", testClassName, testMethodName));

Related

NoClassDefFound of MasterNotRunning when using janusgraph backend HBase

I am using janusgraph, with storage backend HBase. Currently I am trying to add vertices to the database. The part of the code is
public class Graph {
private static JanusGraph graph = JanusGraphFactory.open("conf/jg.properties");
public static JanusGraph getGraph() {
return graph;
}
public static void addVertex() {
for (int i=0; i<5; i++) {
graph.addVertex("test", i);
}
graph.tx().commit();
}
}
with the main function calls
Graph.addVertex();
The error is
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/MasterNotRunningException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:56)
at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:477)
at org.janusgraph.diskstorage.Backend.getStorageManager(Backend.java:409)
at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1376)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:164)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:133)
at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:80)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.MasterNotRunningException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 16 more
I am using janusgraph 0.2.0, in maven 0.2.0
and hbase 1.2.0, java 1.8
I set storage-hostname=127.0.0.1 in jg.properties, so is it a dependency error? Where is exactly the MasterNotRunning?
I have found the solution, but still curious.
I search the class MasterNotRunning and found this is in package org.apache.hadoop.hbase and finally make a guess to add org.apache.hbase & hbase-client into dependency. And the error disappears.
However, I still could not find the reason of this error. If some code in dependency jar uses the class MasterNotRunning then it should import the hbase-client jar, then this should be already in the dependency. How can this code pass the compiling and finally throws an exception during the running time.
Just add, I uses export->runnable jar file to get my jar, so all the dependencies should be added into it.

How to resolve JVMVRFY107 ; class=com/cmb/gce/aps/utils/MappingHelper, method=convertToDB

I am writing Junit test case for EmployeeSerice using Powermock.
It working on local Eclipse. But it gives java.lang.VerifyError on when it runs in jenkins.
com/cmb/gce/aps/utils/MappingHelper class is used in to be tested class.
Both Environment has jdk 1.6, Junit 4 and powermock-mockito-1.4.8-full.jar, mockito-all-1.4.8.jar,
javaassist.jar
Added stack trace.
**at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:265)
at java.lang.ClassLoader.defineClass(ClassLoader.java:202)
at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:211)
at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:146)
at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
at com.citi.cmb.gce.aps.pojo.IntradayAckUpdaterPMTest.testupdateStatus(IntradayAckUpdaterPMTest.java:91)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:322)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJUnit44RunnerDelegateImpl.java:309)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(PowerMockJUnit47RunnerDelegateImpl.java:112)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJUnit47RunnerDelegateImpl.java:73)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThenAfters(PowerMockJUnit44RunnerDelegateImpl.java:297)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl.java:222)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:161)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:135)
at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:133)
at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:112)
at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:57)
**
If anyone knows please post your answer. Thanks in Advance.

Axis Client gsoap Server

I already have a C++ server containing a service that inserts an user to the DB, the service work's great when I test it on console.
But the fact is that I'm developing a Java client application that consumes the service with Apache Axis, unfortunately it doesn't works. I have been searching for information that could help me with this trouble but I don't see any similar implementation.
My Apache Axis files are in /usr/share/java, which is the value of my AXIS2_HOME variable, this, in order to execute:
java -cp $AXIS2_HOME org.apache.axis.wsdl.WSDL2Java -p CrearAlumno http://localhost/CrearAlumno.wsdl
to generate the files, later I execute:
javac -cp $AXIS2_HOME *.java
to compile my files Including the Client Class
//CrearAlumnoClient.java
package CrearAlumno;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
public class CrearAlumnoClient{
public static void main(String[] args)
{
Input in = new Input("asdf", "adgfsdf", "asdg", 453, "asdf", "asdfasdf", "pasdfsd", "asdfsd");
try{
CrearAlumno_Service service = new CrearAlumno_ServiceLocator();
CrearAlumnoPortType port = service.getCrearAlumno();
String response = port.getInfo(in);
}catch(RemoteException e){
e.printStackTrace();
}catch(ServiceException e){
e.printStackTrace();
}
}
}
but when I excecute:
java CrearAlumno.CrearAlumnoClient
My application throws this errors:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: javax.xml.rpc.ServiceException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
I have no idea how to solve this errors, I have been searching for an implementation but at this moment, I dont have it.
I will also be pleased if anyone can show me a simply implementation of Axis and gsoap.
Thank you for your attention :).
This looks like a simple case of your classpath not being set up correctly.
There's information on that specific topic here: http://axis.apache.org/axis/java/install.html#Classpath_setup
You need to ensure that the jar file containing javax.xml.rpc.ServiceException is present.
I see you are setting up your classpath using -cp $AXIS2_HOME which won't work. At best if your jars are in $AXIS2_HOME then you will need to do $AXIS2_HOME/*.jar but it all liklihood you'll need to have something more like:
set AXIS_HOME=/usr/axis
set AXIS_LIB=$AXIS_HOME/lib
set AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:
$AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:
$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar:
$AXIS_LIB/wsdl4j.jar
export AXIS_HOME; export AXIS_LIB; export AXISCLASSPATH
Then invoke your application with:
java -cp $AXISCLASSPATH
With regards to integration between Axis and Gsoap it really should be quite straightforward. There shouldn't really be any special interventions required because you're crossing between java and c world - at least for simple use-cases.

Official supercsv dozer example does not work with Play — Play 2.1.1, Java

Update:
Now I found out something very strange, it works when i put the compiled test classes directly
into the "super-csv-dozer-2.1.0.jar" with the same structure as in the svn repo.
But as soon as i use my own package it wont work. I always used the entire path
like this: myPackage.csv.SurveyResponse.class
What am i missing? and why does it work in a normal Java Project but not in a Play Project?
I also tried it outside of eclipse in a different directory and dont have any checkouts from
the svn repo that could confuse the paths. Another thing i tried is to put the Writing.class into adifferent package but didnt help.
Original qustion:
Im trying to use SuperCSV with Dozer in a Play Project.
The official supercsv sample works fine in a separate Java Project.
But when I put the code and the needed SuperCSV Jars in a freshly created Play project I always
get a ClassNotfoundException for SurveyResponse.class in this line of code:
beanWriter.configureBeanMapping(myPackage.csv.SurveyResponse.class, FIELD_MAPPING);
Here a screenshot of my project structure:
http://oi44.tinypic.com/mrqp7s.jpg
I made sure that all the JARS are available, I put them unmanaged into the /lib folder,
they are available in eclipse and no errors appear during compilation.
I debugged the code and the SurveyResponse.class is found and the beanWriter is initialized.
So somehow Play must do some magic in the background to trigger this bug.
What could play be doing in the background to possibly trigger such odd behavior?
What could I try to do to fix this?
Changes I made to the sample so it works with Play:
I used exactly the same code as the offical supercsv example.
The only change i did is remove the Writing.main(..) method and set the methods Writing.writeWithDozerCsvBeanWriter()
and Writing.partialWriteWithCsvDozerBeanWriter() to public,so it can be accessed from the Application controller.
And of course I changed the package name in all classes to package myPackage.test;
Links to sample:
See in the comment, i cant add more than 2 links because of low reputation.
Controller:
public class Application extends Controller {
public static Result index() throws Exception {
Writing.writeWithDozerCsvBeanWriter();
Writing.partialWriteWithCsvDozerBeanWriter();
return ok(index.render("Your new application is ready."));
}
}
Code that triggers error in Writing class:
ICsvDozerBeanWriter beanWriter = null;
try {
beanWriter = new CsvDozerBeanWriter(new FileWriter("target/writeWithCsvDozerBeanWriter.csv"),
CsvPreference.STANDARD_PREFERENCE);
// configure the mapping from the fields to the CSV columns
//Here the exception occures:
beanWriter.configureBeanMapping(myPackage.csv.SurveyResponse.class, FIELD_MAPPING);
Stack trace:
play.api.Application$$anon$1: Execution exception[[MappingException: java.lang.ClassNotFoundException: myPackage.test.SurveyResponse]]
at play.api.Application$class.handleError(Application.scala:289) ~[play_2.10.jar:2.1.1]
at play.api.DefaultApplication.handleError(Application.scala:383) [play_2.10.jar:2.1.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:144) [play_2.10.jar:2.1.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anon$2$$anonfun$handle$1.apply(PlayDefaultUpstreamHandler.scala:140) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:113) [play_2.10.jar:2.1.1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend$1$$anonfun$apply$1.apply(Promise.scala:104) [play_2.10.jar:2.1.1]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [scala-library.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [scala-library.jar:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_37]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_37]
at java.lang.Thread.run(Unknown Source) [na:1.6.0_37]
org.dozer.MappingException: java.lang.ClassNotFoundException: myPackage.test.SurveyResponse
at org.dozer.util.MappingUtils.throwMappingException(MappingUtils.java:82) ~[dozer-5.4.0.jar:na]
at org.dozer.util.DefaultClassLoader.loadClass(DefaultClassLoader.java:38) ~[dozer-5.4.0.jar:na]
at org.dozer.util.MappingUtils.loadClass(MappingUtils.java:224) ~[dozer-5.4.0.jar:na]
at org.dozer.loader.DozerBuilder$MappingBuilder.classA(DozerBuilder.java:129) ~[dozer-5.4.0.jar:na]
at org.dozer.loader.api.BeanMappingBuilder.mapping(BeanMappingBuilder.java:72) ~[dozer-5.4.0.jar:na]
at org.dozer.loader.api.BeanMappingBuilder.mapping(BeanMappingBuilder.java:67) ~[dozer-5.4.0.jar:na]
at org.supercsv.io.dozer.CsvDozerBeanWriter$MappingBuilder.configure(CsvDozerBeanWriter.java:178) ~[super-csv-dozer-2.1.0.jar:na]
at org.dozer.loader.api.BeanMappingBuilder.build(BeanMappingBuilder.java:42) ~[dozer-5.4.0.jar:na]
at org.dozer.DozerBeanMapper.addMapping(DozerBeanMapper.java:258) ~[dozer-5.4.0.jar:na]
at org.supercsv.io.dozer.CsvDozerBeanWriter.configureBeanMapping(CsvDozerBeanWriter.java:91) ~[super-csv-dozer-2.1.0.jar:na]
at myPackage.test.Writing.writeWithDozerCsvBeanWriter(Writing.java:88) ~[na:na]
at controllers.Application.index(Application.java:12) ~[na:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1.apply(routes_routing.scala:49) ~[na:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$1$$anonfun$apply$1.apply(routes_routing.scala:49) ~[na:na]
at play.core.Router$HandlerInvoker$$anon$6$$anon$2.invocation(Router.scala:164) ~[play_2.10.jar:2.1.1]
at play.core.Router$Routes$$anon$1.invocation(Router.scala:345) ~[play_2.10.jar:2.1.1]
at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:31) ~[play_2.10.jar:2.1.1]
at play.core.j.JavaAction$$anon$2.apply(JavaAction.scala:74) ~[play_2.10.jar:2.1.1]
at play.core.j.JavaAction$$anon$2.apply(JavaAction.scala:73) ~[play_2.10.jar:2.1.1]
at play.libs.F$Promise$PromiseActor.onReceive(F.java:420) ~[play_2.10.jar:2.1.1]
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159) ~[akka-actor_2.10.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) ~[akka-actor_2.10.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:386) ~[akka-actor_2.10.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) ~[akka-actor_2.10.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:212) ~[akka-actor_2.10.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:502) ~[akka-actor_2.10.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) ~[scala-library.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) ~[scala-library.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) ~[scala-library.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) ~[scala-library.jar:na]
Caused by: java.lang.ClassNotFoundException: myPackage.test.SurveyResponse
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.6.0_37]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_37]
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.6.0_37]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.6.0_37]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.6.0_37]
at sbt.PlayCommands$$anonfun$53$$anonfun$55$$anon$2.loadClass(PlayCommands.scala:535) ~[na:na]
at java.lang.Class.forName0(Native Method) ~[na:1.6.0_37]
at java.lang.Class.forName(Unknown Source) ~[na:1.6.0_37]
at org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:823) ~[commons-lang3.jar:3.1]
at org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:889) ~[commons-lang3.jar:3.1]
at org.apache.commons.lang3.ClassUtils.getClass(ClassUtils.java:872) ~[commons-lang3.jar:3.1]
at org.dozer.util.DefaultClassLoader.loadClass(DefaultClassLoader.java:36) ~[dozer-5.4.0.jar:na]
... 28 common frames omitted
Extra information:
I still couldnt solve the problem, but here some extra infomation to narrow down the problem:
The csv header is successfully written to the file when i remove the configureBeanMapping Method call (see code below).
The SurveyResponse class is working too when i do a System.out.println() on a filled SurveyResponse object (see code below).
So its not a problem with the package or class name.
The modiefied Code that writes only the header:
//...more code
myPackage.csv.SurveyResponse response3 = new myPackage.csv.SurveyResponse(42, false, Arrays.asList(new Answer(1, null), new Answer(2,
"Carl Sagan"), new Answer(3, "Star Wars")));
final List<myPackage.csv.SurveyResponse> surveyResponses = Arrays.asList(response1, response2, response3);
ICsvDozerBeanWriter beanWriter = null;
try {
beanWriter = new CsvDozerBeanWriter(new FileWriter("target/writeWithCsvDozerBeanWriter.csv"),
CsvPreference.STANDARD_PREFERENCE);
// configure the mapping from the fields to the CSV columns
//beanWriter.configureBeanMapping(myPackage.csv.SurveyResponse.class, FIELD_MAPPING);
//Prints the value 42 successfully
System.out.println(response3.getAge());
// write the header
beanWriter.writeHeader("age", "consentGiven", "questionNo1", "answer1", "questionNo2", "answer2","questionNo3", "answer3");
//...more code
From what I understand from the error, Play is trying to load the wrong class. Look at this line :
java.lang.ClassNotFoundException: org.supercsv.mock.dozer.SurveyResponse
I think that SurverResponse is one of your own project classes and not part of SuperCSV. Try to prefix it with the full path such as :
beanWriter.configureBeanMapping(whateverpackage.models.SurveyResponse.class, FIELD_MAPPING);
SurveyResponse and Answer are test classes of the super-csv-dozer artifact - so they aren't packaged in the distribution (i.e they're not in Maven or in the zip file on SourceForge).
You can view the test source online or checkout the SVN repo (which it sounds like you've already done) and just copy them into your Play project.
Both files are in the following directory:
supercsv/super-csv-dozer/src/test/java/org/supercsv/mock/dozer/
I'm a little curious why you're not getting a compilation error when trying to use SurveyResponse in your code. My guess is that you have the super-csv-dozer project checked out and open in your IDE and your project is finding it.

Exception in thread "main" java.lang.NoClassDefFoundError: =

I created a new maven project in Eclipse and on runtime I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: =
Caused by: java.lang.ClassNotFoundException: =
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: =. Program will exit.
In other threads the class is mentioned where the problem occurs but here it simply says nothing.
The code is also used in a different project (with slight tweaks in terms of calling a method) but the rest of it is same.
If anyone can help me resolve this issue..it will be highly appreciated.
It looks like something is passing in = as the class name. It doesn't say nothing - it says =.
For example, when I run:
java =
I get:
Error: Could not find or load main class =
There's no colon, but it's otherwise the same.
Look at where you're trying to specify the class name, and see whether there's a stray = around. For example, suppose you had:
java -Dfoo = bar ClassName
instead of
java -Dfoo=bar ClassName
You'd see the same thing. I'm not familiar with Maven, but if you ever specify a set of arguments in it, I'd look at that part of the configuration file.
Deleting the workspace worked for me.

Categories