Editor does not contain a main type in Katalon studio - katalon-studio

A test case is created in Katalon studio and i am trying to run with java application.
I have received the below error..
"Editor does not contain a main type"
Any insights to solve this error is helpful.

Related

How can I fix "build failed, do you want to continue"? In Visual Studio Code

I got an error when trying to debug Java code in Visual Studio Code.
The error is below
build failed, do you want to continue?
I have tried clearing the workspace, but it doesn't work. How can I fix this issue?
The problem was solved.
I resolved this issue by clearing the workspace cache in Visual Studio Code. Here is a link to the relevant page: Visual Studio Code Clean Workspace Directory. I had renamed a number of folders, class names and packages.
Apparently the Red Hat Developer plugin managed to get out of sync. The .classpath file was out of sync with the POM file. Wiping out the workspace cache caused the plugin to recreate project data from the Maven specification. The problem was solved. I am not sure, but if anyone from the Red Hat project reads this, it looks to me like a bug, or deficiency. In any event it can be worked around.
Original answer:
I think Liu Bei was not clear enough. I am experiencing the same issue. I have a project that builds perfectly in Maven and when I launch the debugger in Visual Studio Code this notification appears in the lower right-hand corner of the Visual Studio Code window.
Obviously the "Debugger for Java" extension thinks there is a build problem. However there are no errors reported in the PROBLEMS, OUTPUT, DEBUG CONSOLE or TERMINAL tabs.
The project builds, and packages in Maven just fine and it can be debugged in attach mode which is tedious at best.
There is something going on in Visual Studio Code that's not being reported anywhere that I can find. I suspect the RedHat Visual Studio Code plugin for Java is in the mix, but I need help figuring out how to work around the issue.
I have to say that we are spending way too much time resolving issues with tools and dependencies and not enough time on the app. The project we are working on is intended for open source distribution. The Spring Framework seems ideal for our purposes, but the tooling, not so much. We are not very far into the project and I am already receiving pressure to switch to ASP.NET Core.
I really need a little help...
This didn't work for me, but I found out what did.
First of all, looking at the Java Dependencies plugin gave me a hint that something was out of sync. The name of my application (artifact) did not match the name in the Java Dependencies tree view.
This was fixed by clearing the Visual Studio Code workspaceStorage folder completely!
This folder was in my case located in (Windows 10):
C:\Users\<myuser>\AppData\Roaming\Code\User\workspaceStorage
If you can't find it at this location, simply search for the folder workspaceStorage.
Next press Ctrl + Shift + P (in my case) to open the Visual Studio Code action prompt. Then choose the command:
Java: Open Java Language Server Log File
This will open a log file which is normally not displayed when building your Java code, and will tell you exactly what went wrong with the build.
In my case it was a conflict as I had two AppConfig.java files, one in main and one in test. Maven handles this fine, but apparently the Visual Studio Code Java builder does not.
Obviously these are bugs in the plugins which I will report to the GitHub contributors, but for now we will have to live with a little manual work.
Still I hope this helps all of you frustrated Visual Studio Code Java developers out there.
It worked for me to change the user setting in file setting.json to "java.debug.settings.forceBuildBeforeLaunch": false in Visual Studio Code, which will disable the check before run/debug.
Build failed error in Visual Studio Code
This error occurs because in your workspace folder the other source code has some errors in it.
So create a new folder and make it as a workspace folder and then write your codes in that folder and run it.
I had that error also and it worked for me, so check for yours.
Using OS X, I managed to overcome this problem. You can either access it from your Terminal or simply use a
shortcut (Command + Shift + C).
Select Base System and Library. Look for the Java folder and click on the Java Virtual Machines folder.
Check if is there the actual version of JDK (most up to date). I've noticed that I had two JDK folders one probably inherited from a previously installation and the most up-to-date Java 15. I dragged 'jdk-14' to the waste bin. Enter password, close finder and restart Visual Studio Code.
It works fine now!
For me, the problem was that I created a folder within a folder for arranging my Java program files with the reference to data structures. In the log file, it was showing that the .java file in the inner folder was not on its project's build path.
Just after deleting that folder and completely deleting all the files in the workspace folder manually in the location C:\Users<myuser>\AppData\Roaming\Code\User\workspaceStorage, this problem was solved!
I fixed this problem by doing the following steps:
Step 1: Opening Visual Studio Code settings (bottom left) https://i.stack.imgur.com/xPlkj.png
Step 2: Searching "Java debug" and selecting Java Debugger under Extensions https://i.stack.imgur.com/797M3.png
Step 3: Find Force Build Before Launch and uncheck it https://i.stack.imgur.com/igtRa.png
And you're done!
First of all, check carefully the errors on Visual Studio Code log and try to not get biased by the community common errors. To do this, press Ctrl + Shift + P to open the Visual Studio Code action prompt. Then choose the command:
Java: Open Java Language Server Log File
By doing this you can find the exact exception that is happening. In my case, I had two exceptions:
java.lang.NoClassDefFoundError: javax/annotation/processing/AbstractProcessor
And
java.lang.NoClassDefFoundError: com.demo.myapplication
So, I was biased to think that error was related to the Java version or stuff like that, but it was related to a Lombok extension installed in Visual Studio Code.
In the end, I found this thread and tested this solution and it worked like a charm.
Here is the solution explained by him:
Finally I got it working. The issue is with the additional argument -Xbootclasspath added by the Lombok extension to the java.jdt.ls.vmargs. I figured it out by integrating the Lombok with eclipse and opened the eclipse.ini file for the changes.
I uninstalled the vscode-lombok extension;
I downloaded the lombok.jar (version 1.18.6) file from https://projectlombok.org/download;
In Visual Studio Code, in settings.json, for java.jdt.ls.vmargs key, I added the argument
-javaagent:"PATH_TO_DOWNLOADED_LOMBOK_JAR_FILE"
A last necessary step (missed by the GitHub guy) is to reinstall the Lombok extension.
I had the same problem.
I just downloaded this provided for Visual Studio Code,
Extension Pack for Java.
Click on the link, download and open it. It will automatically configure Visual Studio Code for Java.

Is there a way to use shared projects (shproj) in Visual Studio Code?

Hi,
Shared project seemed like a good idea to share code between .NET Core 2.0 web project and .NET 4.7 WinForms project.
I have bunch of extensions inside as well as web api client code which is used by both projects.
Everything works well in Visual Studio 2017.
However, on the road I use MacBook computer with Visual Studio Code which does not recognise shproj in any way. I also tried Insider version with new multiple workspace, but that also seem to work only with actual projects (csproj).
I know there is Visual Studio for Mac, but it is huge and far exceeds my on-the-road needs, so I would like to avoid it.
So, my question is - is there a way to utilize Visual Studio Code with projects that use shared projects (shproj)?
I would like to run/debug such projects in VSCode.
If not, does it make sense to create feature request somewhere? I mean, shared projects were designed for cross-platform code sharing and VSCode is brilliant cross-platform editor so it makes sense.
Or is this not part of VSCode at all, but some extension (like OmniSharp)?
Thanks,
Mario
At least now (2021) it seems to work fine.
TLDR; Create a new project with Visual Studio (2019) and add a "Shared Project" to that Project/Solution. Then open the project folder in Visual Studio Code and add the Shared Project folder to Workspace. In VS Code add a new Class to the Shared Project and adjust the *.projitems file to include the new class in the compile process. Run the project in both VS Code and VS to verify everything works as expected.
Following are the steps that I used. It looks like a lot, but it should only take about 10 minutes to setup this basic sample.
Open Visual Studio (2019)
Create a new "Console App (.NET Core)", give it a name and a location and select "Place solution and project in the same directory".
After creating the project you should have a new solution in "Solution Explorer" containing the new Console Application project.
Right-Click on the solution and select "Add" > "New Project..."
Select and add a new "Shared Project"
Add a new class to your Shared Project. In "Solution Explorer" right-click the shared project and select "Add" > "New Item..." and select the "Class" template.
In your "Console Application" add a reference to your Shared Project by right-clicking on your Console Application project, then select "Add" > "Shared Project Reference..." and select the listed shared project (*.shproj)
Use the new class of the Shared Project in the Console Application project
Run the Console Application to check if it builds and uses the shared class successfully.
Close Visual Studio (2019)
Open Visual Studio Code
Select "File" > "Open Folder" and select the folder where the Console Application is placed.
Note: If VS Code shows a message "Required assets to build and ... are missing" then select "Yes".
Select "File" > "Add Folder to Workspace..." and select the folder where the Shared Project is located.
Select "File" > "Save Workspace As..." and save the file to the project folder of the Console Application.
Open a new integrated Terminal in VS Code (in Menu "Terminal" > "New Terminal") and make sure that the current working directory is the folder of the Console Application. Then type "dotnet clean && dotnet run" to clean, build and run the solution.
Assuming we now want to add a new Class to the Shared Project from Visual Studio Code, we have to do some extra work, that normally Visual Studio (2019) would do for us when adding a new Class.
In VS Code right-click the folder where your shared class is located and add a new File. Give it a name with .cs extension and add the according code to the file to make it a valid class file.
Open the *.projitems file and find the part where your first class file has been added already. It should look like this:
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)SharedClass1.cs" />
</ItemGroup>
Now add the new class file to this ItemGroup section like this
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)SharedClass1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SharedClass2.cs" />
</ItemGroup>
Use the new class in the Console Application, save all files and type "dotnet run" in the integrated Terminal.
Check if everything builds and runs as expected.
If you notice that it builds successfully, but VS Code shows some error like "The type or namespace name 'Class2' does not exist in the namespace 'SharedProject1'", then restart VS Code. After restart it should be able to detect everything as expected.
Close VS Code and Open VS (2019) by double-clicking the *.sln file.
Build and Run the project to verify that all changes are compatible with VS (2019).

Errors in Android Studio

In Eclipse, when I edit a class, all other classes are automatically checked for errors. For instance, when I comment out a function in class A I see all classes that refer to the function marked red in the project explorer.
In Android Studio when I do the same, no class is checked for errors. The project explorer shows no errors. It is only until I open a class that the errors become visible for this specific class.
How can I have the same behaviour in Android Studio as in Eclipse?
Include this in your gradle.properties:
org.gradle.daemon=true

How to view compiler error in Eclipse (Luna)?

I am new to the Eclipse (Luna) IDE. I downloaded a sample bluemix node.js application, which I have opened in Eclipse. When I do "Build All", I do not see any information in either the "Console" or the "progress view" window. If I deliberately type anything wrong in the code window, I do not see any errors in either of this window. How do I know whether the code has been compiled properly and how do I know the errors if any?.
JavaScript is an interpreted language, not a compiled language. There is no manual compile step where you can see compilation errors. If you've want the editor to assist you with syntax and content completion as you type, the nodeclipse plugin for Eclipse should help.

Enide Studio (Nodeclipse) - Can't debug project as NPM package on OS X Mavericks

I've set up a new project in Enide Studio. (Which's an Eclipse with Node.js plugins.)
I right-click the project and choose "Debug As -> Debug Cofigurations...".
In the popup window I double-click "NPM" configuration, and type "start" to the Goal textbox.
Then click to "Debug" and get the following error in the console:
"execvp(): No such file or directory"
When I run "npm start" from command line, it works fine.
If it matters, my operating system is OS X 10.9.
Have anyone faced with the same problem? What can be the cause?
Right-click on .js file and then "Debug As -> Node application"
With Node any .js file can be executed. (Hint: this also give you one more way to validate.)
Other debug options were not yet implemented or tested (as ChromeDevTools can give more options, we just have not tried everything, but implemented the most straight-forward ). Play with what you can, raise an issue on github with the error / feature description. https://github.com/Nodeclipse/nodeclipse-1/issues
Be sure that you have read http://www.nodeclipse.org/#support and Online / built-in Help Debug page.