No matter what I do Lightrun will generate the following error message:
General agent error at jvm_internals.cc:186.
This is my first time using Lightrun.
This is my code:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println(new Scanner(System.in).nextInt() + new Scanner(System.in).nextInt());
}
}
The code itself runs perfectly.
I am using IntelliJ IDEA 2022.3.1.
LR doesn’t work on this version. A bit buggy on the ij versions for the past 2 months…
Related
I'm attempting to run the following program:
package test;
import java.awt.*;
public class Main {
public static void main(String[] args) {
System.out.println(MouseInfo.getPointerInfo().getLocation().x + "," + MouseInfo.getPointerInfo().getLocation().y);
}
}
However, after running it in IntelliJ, the program will just sit there for about 10 seconds and then exit with this:
Process finished with exit code -1073740791 (0xC0000409)
Most of the google results (and stack overflow posts) related to this error seem to think it is an NVIDIA driver issue, but those posts also state that an updated driver with a fix was posted in February and the driver on my computer is version 382, which is a newer version than the fix posted, so it would have included that fix.
Any ideas how to resolve this issue?
I have no idea anymore. Since today 14pm the hot-code replace does not work anymore.
I had jdk8_74x64 installed on win10x64.
I test it using this code in a simple project (without maven and without dependencies):
public class Test{
public static void main(String[] args){
System.out.println("hi"); // breakpoint here, it stops always
System.out.println("ho"); // on suspending i change this to "hoy".
}
}
Start eclipse with new workspace - still not working
Restart computer - still not working
Uninstall all JDK/JRE and remove all javaws.exe, install again - still not working.
Uninstall eclipse, reinstall eclipse - still not working
Installed netbeans, using "apply code changes" - still not working.
Delete jdk with all javaws.exe, delete eclipse, uninstall netbeans, use new user, install jdk 8u31x64 install netbeans - still not working
Installed idea-community-edition15+jetbrains, change ho to hoy and apply class-changes (idea notifies me 1 class reloaded) - still not working.
How to get hot-code-replace working?
Hm,
public class Test{
public static void main(String[] args){
System.out.println("hi"); // breakpoint here, it stops always
System.out.println("ho"); // on suspending i change this to "hoy".
}
}
does not work but
public class Test{
public static void main(String[] args){
foobar();
}
public static void foobar(){
System.out.println("hi"); // breakpoint here, it stops always
System.out.println("ho"); // on suspending i change this to "hoy".
}
}
Works great everywhere.
This problem only started recently, but all my main functions on various programs don't work (they have worked in the past).
They now all return:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at com.avaje.ebeaninternal.server.lib.sql.Prefix.main(Prefix.java:40)
Here is an example of a class that gives this error:
package PACKAGE_NAME_HERE;
public class SomeClass {
public static void main(String[] args) {
System.out.println("Test");
}
}
You're calling method main in com.avaje.ebeaninternal.server.lib.sql.Prefix (which is part of Maven, source can be found here) from somewhere.
Line 40: String m = e(args[0]);
And if you don't pass any command-line arguments, you don't have args[0], and you got ArrayIndexOutOfBoundsException.
That's all I can tell from your question(can't use comments yet, but more clarification/what did you change recently(anything about Maven?) would be nice).
Deleting the project and making a new one fixed this error. Not sure why, maybe I accidentally messed up the setup or something.
I am trying to run this project called "hello user". I am new to Java, so wrote a simple program that takes your name, and displays "Hello ". while Running it, I get the following error:
run:
Error: Could not find or load main class hello.world.HelloWorld
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
But when I run file HelloWorld.java, it does it fine
I am doing this on Netbeans IDE 7.2
Rather than the coding error, it could be related to IDE. Since the "Run File" runs okay, but 'Run Project" does not, I believe you have something to set up in IDE itself. Right click the project, and select "Set is as Main", now run the project. I am just giving it a guess, may not help you. But it worth a shot.If it does not help, please paste your code too.
Your class needs a public static void main(String[] args) function. And moreover I suspect that the error could be in the package.
If you want your class in <main_package>.<sub_package>, The directory structure is
- main_package
- sub_package
-HelloWorld.java
And be sure to write your class like this.
package main_package.sub_package;
public class HelloWorld {
public static void main(String[] args){
System.out.println("Hello " + args[o]);
}
}
This is all due to the naming convention in Java
You need to run the .class file containing the public static void main(String[] args) method..
Here, your HelloWorld.java file might contain a class with main() method.. So, you can run it..
This is because, execution of any Java program starts with the invocation of main().. JVM needs an entry point to your code.. Which is main().. If it doesn't find one.. It will not run..
So, make sure, whatever class file you are running, it should have main() method..
UPDATE :- And for the starting point, may be you can skip using packages.. Just go with plain Java class without packages..
This message can also appear in Eclipse (Juno 4.2.2 in my case) and I have found two potential causes for it.
In my cases:
1. a DTD was in error. I deleted the file and that solved the issue*.
2. having cleaned the project, an external Jar that I had built externally had been deleted as could be seen from Properties -> Java Build Path -> Libraries.*
*Having solved either of the above issues, it was necessary to restart Eclipse
if you are using intellij idea then just rebuilding (clean and build) project might solve your problem . because intellij might be still trying to load the old classes which are not there or changed
Make sure you call looks like below:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("hello user");
}
}
To run a Java class in stand alone mode, public static void main(String[] args) is the entry method, which is must.
I am getting a ClassNotFOundException while running a code.I am using Eclipse.
Although it has main method with proper arguments it is still not able to launch the code.
Package name and import is also correct.
public class TestNew {
public static void main(String[] args)
{
ArrayList<String> sumList=new ArrayList<String>();
Cm cm=new Cm();
sumList=cm.sumListCombo();
for(int i=0;i<=sumList.size();i++)
{
System.out.println(sumList.get(i));
}
}
}
Import of respective packages are done.
Try refreshing the Project, then clean it and build it. If there is no problems, your code will work. If there is a problem, it will be some kind of 'Organize Imports' issue. Ctrl+Shift+o and you are ready.
Try Ctrl + Shift + O if you're on windows.
This organizes your imports(adds missing ones and removes unnecessary ones).
Then on the menu bar, Project >> Clean...
Then re-launch your app.