Error: Could not find or load main class Start - java

"Error: Could not find or load main class Start" This is the error I have been dealing with for the past few days, no matter how much research I do it doesn't seem ot help me at all.
I know that it is trying to locate "Start.java", I believe I have configured Eclipse to look for Start.java in the (default packages) package, where it is. However, I click the run button and the error just keeps popping up. Please, I desperately need help, any comment will be appreciated greatly.
[Update] I managed to add Start.class to my classpath somehow, I just tried every single method on StackExchange and one of them seemed to work. However, yet another problem has arose, on launch this occurs:
Exception in thread "main" java.lang.SecurityException: class "bgv"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at Start.main(Start.java:11)

Please check the main class in Main tab for run(debug) configuration,
it should be org.apache.ofbiz.base.start.Start,
I got the same error when I am using the Main class: org.ofbiz.base.start.Start
https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse
I hope it helps

Related

Successfully implementing external classes in Eclipse. (Java)

I have been trying to use this external class folder which was given from my programming lecturer a few months back. I followed people's explanations of how to add via "configure build class", and the application somewhat recognises the class because a shortlist of some of the methods are given. It also does not return any errors prior to runtime but once it's ran I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: Console
at lab3.q2.main(q2.java:15)
Caused by: java.lang.ClassNotFoundException: Console
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
This is really frustrating as it works from the linux computers in my college without issue. The class file is just a variation of the scanner that we use for user i/o, I have it attached.
Console.class file

Java3D - Some classes not found but classpath is set correctly

I have a class that uses Java3D that successfully compiles, although when I try to run it it says: Exception in thread "main" java.lang.NoClassDefFoundError:
javax/media/j3d/Canvas3D,
With the following stack trace:
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Canvas3D
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Stuff I have already tried:
I couldn't even get it to compile until I copied the Java3D jars into /jre/lib/ext/.
I have the latest Java, Java3D and I am using Notepad++ and I have tried reinstalling Java3D.
I have set the classpath/path correctly.
There are no errors in the code.
I can run normal Java applications I have created.
I have tried using the classpath thing when running the application (java -classpath blahblah ApplicationName).
I have checked inside the jars and the classes (including Canvas3D) are definitely in there.
Not everything you say is true.
IF the classes are in the jars, and IF you have set the classpath correctly, THEN you would not get this message.
I suspect you have a build path confused with a classpath (which is mostly associated with runtime, where build path is associated with compile time). Without knowing more details of your runtime environment, it's hard to be more specific.
It always puzzles me how someone with a problem they cannot solve asserts so definitely that all these things are set up "correctly": how do you know? Isn't the problem some evidence to the contrary, at least enough for a small doubt?

Napkin custom LookAndFeel in Eclipse

Premise
I'm pretty new to GUI programming but I'm looking for a way to put the Napkin Look and feel onto my application though Eclipse.
What I've done thus far
I've had a look around and from what I can see I need to put the napkin .jar's into my buildpath. I've tried to do this by right-clicking in the navigator and selecting import --> File system and highlighting the .jars associated with Napkin.
Inside of my Main I've added the following code:
try{
UIManager.setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel");
}catch(Exception e){
e.printStackTrace();
}
Which I believe should apply the Napkin Look and Feel, unfortunately, I keep getting this error:
java.lang.ClassNotFoundException: net.sourceforge.napkinlaf.NapkinLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
at yulfy.alterd.FrameTest.main(FrameTest.java:8)
Question
What on earth am I doing wrong? (I'm sorry if it's terribly obvious!)
Thanks for your time!
Links
Napkin site:
http://napkinlaf.sourceforge.net/
Notes
It seems that the latest is 1.2 and not alpha001 which is the first
file available on Sourceforge.
If any further clarification/information is needed, don't hesitate to
post.
right click over your project, go to build path, click on "add external jar" and select the jar

Junit in eclipse produces NoClassDefFoundError when using junit

I am new to jUnit and unit testing in general, and have been trying to set up my testing environment and failing all day. This is trying to test a method in my android application.
I added a test class to the same package the java class is in. I added a method as below:
#Test
public void testIsExpectedNote() {
assertTrue(Frequency.isExpectedNote(440, "A"));
}//should return true
This fails with the following stack trace:
java.lang.NoClassDefFoundError: android/util/Log
at dataLogicLayer.Frequency.isExpectedNote(Frequency.java:13)
at dataLogicLayer.FrequencyTest.testIsExpectedNote(FrequencyTest.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: android.util.Log
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 25 more
Any ideas what is going wrong? I have been playing with my run configurations and in the classpath i have:
jre system library [jre7]
junit 4
Do you have the android sdk in your classpath? search for the jar containing the class android.util.Log in your classpath
regards
Grub
The answer was to make a new project and do testing in there instead, must make it an android junit test, and make sure the run configs are correct. thanks to Grub for your help
Seems like you are mixing Android SDK and Java SDK. You should not be doing that. Android is a self sufficient library.

Error NoClassDefFoundError/ClassNotFoundException

after about a month of not opening eclipse at all, I get a strange error
java.lang.NoClassDefFoundError: Z
Caused by: java.lang.ClassNotFoundException: Z
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main"
I don't really understand what it wants, it doesn't show me anything else, something about main class "Z" not being defined? but it is, isn't it?
[CODE][/CODE] doesn't work very well here so I'll put source here: http://pastebin.com/heMhDqU2
Thank you.
Edit 1: it shows me when I try to compile and run. Btw, indent code by using 4 spaces for 500 lines... seems kinda reduntant
Your code is fine it compiles here.
Most probably an eclipse error.
Try this.
Close eclipse
Start eclipse with the flag .../eclipse.exe -clean
Press Project -- > Clean

Categories