My java program which I created could not recognize SAPJCO3.jar which is already in the system class path and included in eclipse/project with buildpath option available in eclipse.
ERROR MESSAGE
java.lang.ClassNotFoundException: No ClassLoaders found for: com.sap.conn.jco.AbapException
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sap/conn/jco/AbapException
If I just remove AbapException from my program and give normal java exception , it throws error on the next JCO class. The same program works good in NETBEANS which I used for testing. Since my actual project was developed in eclipse I need the program to run in Eclipse.
Can any one help me with this.
Try adding the property to your windows "System variables"/"Environment variables".
Variable Name: java.library.path
Variable Value: C:/SAPJCo
This will work for Eclise.
Good Luck!!
Related
So recently I was bombarded with the below error.
I have a very bad understanding of Java and how the internal memory location and file compiling work. So, when I ran my program(every program gave me the error so I guess it doesn't matter which program I ran and for that matter, I didn't include it here), it started giving me this error. I looked if there were any errors with my classpath and working directory, but still, after applying those too it didn't help much, and I still got the same errors.
The programs ran from the terminal using commands but from the normal "Run" function, it gave me this error.
I just restored the default setting of the IDE and it now works.
The difference I found was that after restoring the default settings, the project location was the default folder- IdeaProjects- whereas when I encountered the error I used to set my own location for the projects. Is it due to this? I had the same kind of problem in eclipse when I set the location of the project outside of the eclipse workspace.
Is the location of the project simply the reason I got the below error and if so why? I just don't understand how the internal mechanism of the whole programming thing works. About the directory, memory allocation, etc. Can anyone provide some decent materials after which I can be at a stage where I can separate what is the error and why is it causing or why the program doesn't run?
Full error:
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=57983:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/(myname)/Desktop/Folders/College/2nd sem/CS 2/Labs:projects/Lab3/Lab3dot34.0/out/production/Lab3dot34.0:/Users/(myname)/Desktop/Folders/College/2nd sem/CS 2/Labs:projects/Lab3/Lab3dot34.0 Main
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
Initially, I tried to view the working directories and add/change the classpath from the project structures like every suggestion found on the internet but still, the error existed.
I created a new java project in eclipse. This is the first time I am using it.
After creating java files.
I tried running a java file by right clicking->Run As-> Java Application
It showed the error :
Error: Could not find or load main class ISBN
Caused by: java.lang.ClassNotFoundException: ISBN
What could be the reason for this error? How do I fix it?
I'm trying to run a script that was working fine until I changed the home folder.
Once I changed the home folder I ran into a few issues but I was able to resolve them. The only thing I have not been able to resolve is the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/internal/JsonToWebElementConverter
at BrowserStackAndroid.main(BrowserStackAndroid.java:43)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.internal.JsonToWebElementConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 1 more
This is an interesting error that, after some research, I have not been able to wrap my head around.
The class that it is searching for is in the org.selenium.remote dependency. Except that it's not in the internal folder but the remote folder.
So the class that it is searching for is JsonToWebElementConverter.
This class is located in the following path
org/openqa/selenium/remote/JsonToWebElementConverter
The folder that the IDE (or Maven?) is looking into is
org/openqa/selenium/remote/internal
Which only has the class WebElementToJsonConverter
I've tried reinstalling the library via maven in several different ways, using different dependencies, etc but haven't been able to fix this issue.
I've never come across an issue like this before so I'm really excited to see what the solution is going to be.
Notes:
The error is being thrown because of the following line of code
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("https://" + userName + ":" + accessKey + "#hub-cloud.browserstack.com/wd/hub"), caps);
This project worked perfectly fine before but as soon I changed the directory of the project stopped working.
This is happening as you have same class or library with in 2 dependencies. Simply removing selenium based dependencies will resolve the issue as all selenium dependencies already comes with Appium java client. For classpath you can check at java docs
So the way to set class path via cmd (Navigate to project root folder)
set CLASSPATH= target/org/openqa/selenium/remote/internal/JsonToWebElementConverter
Note: for maven project all compiled java files should be in target folder. If you are facing same issue you can add missing class inclasspath destination should be target folder as explained in java docs
I am trying to run a Matlab function (Matlab 2017a) from Java (as shown here) and want to use the Java Matlab engine API for this purpose. I started adding the engine.jar file to the external libraries (I'm using the IntelliJ IDE). However, this gives the following error: "Exception in thread "main" java.lang.UnsatisfiedLinkError: no nativemvm in java.library.path"
A first search got me here where it says that the matlabroot should be added to the PATH permanently. So I checked my PATH using the Windows UI to find that matlabroot\R2017a\bin is already included. However, in my case I still get the error and have no idea what to do now. Any help is highly appreciated.
Answering my own question: Adding \R2017a\bin\ to the PATH is not sufficient. It has to be \R2017a\bin\win64 and then it works.
Everything works fined, but suddenly eclipse stopped execute and junit tests or even main method, when i run them using run as - > Java application, run as -> junit test
It simply throws error
Caused by: java.lang.ClassNotFoundException: package.ClassName
whene ClassName - is class from where i trying to run method main.
It affect only one of my projects ... Different workspaces works fine, other project in same workspace works fine as well.
I'm sure if i recreate current project, error will gone. But the adjustments of this project in eclipse is really hard, so i want to avoid it.
Any clue?
The ClassName is not in the Class Path, if you start from console you should use -cp parameter , if from eclipse, please add ClassName to the sources of current(start) project.
Thanks to adarshr, I was able to look at the Problems window and determine that the build was failing because it could not find a class I had written.
I had used the MS TFS plugin to create a "shelveset" and it was supposed to have removed my pending changes in the process. However, this integration with the TFS snapin and Eclipse is obviously not well implemented, since the Eclipse project still thought the file existed and was complaining that it could not be compiled.
I went and manually deleted those "files" or "non-existing files" from the Eclipse project (that I thought I had removed with the shelveset action) and the problem was solved.
Also....
Another annoying things is that the Tomcat error I was getting by trying to debug within Eclipse was like this:
SEVERE: Error configuring application listener of class
com.CompanyName.ProjectName.servlet.StartupConfigListener
java.lang.ClassNotFoundException:
com.CompanyName.ProjectName.servlet.StartupConfigListener at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1643)
In reality, there was no problem at all with StartupConfigListener.java!! The build failed due to the OTHER problems I mentioned above, and therefore I guess this was the first class it attempted to load and failed.... because the entire project hadn't been able to compile perhaps?
(Here's to hoping my next project is using Visual Studio instead of Eclipse!)
Ok, I finally figured it out. The problem was with installed JRE in eclipse setting. I was playing around with this setting and changed installed JRE to JDK, and for some reason it broke the eclipse project.
You can also try going back to the basics. Check your command line and VM args. I've had this situation where a VM arg I was passing in was a path to a file that had a space in the path, and I had forgotten to include the full path in quotes. So e.g., if my arg looked something like
-DFILE=C:\Documents and Settings\myfile
...I'd get a java.lang.NoClassDefFoundError caused by a java.lang.ClassNotFoundException.