This question already has an answer here:
Eclipse is running the wrong class [closed]
(1 answer)
Closed 8 years ago.
I am a new java developer out here, and ive come across this weird thing, that eclipse still thinks my main class is called illuminati (just randomly wrote something..)
here is a screenshot of the error i get:
so what the problem is, basicly eclipse cant find the mainclass even though i changed the name..
and i dont know how to configure it that the class is gone (or changed name)
Thanks in advance!
Just select the class you want to run (MAIN), then click the green-arrow-in-circle Run icon, and select "Run As -> Java Application".
If you rename the class and you didn't let Eclipse rename the run configuration, then you can simply create a new run configuration for the new class.
Related
I recently installed IntelliJ IDEA by Jetbrains community edition on my linux device. But to run my first program I need to add configuration (I don't have much idea about Java but I have used PyCharm in the past and add configuration panel is quite similar to add interpreter thing there). I don't know any configuration setting, I think it is supposed to automatically load configuration settings, a default one for the first time, but it doesn't. If I have to create a main class first then I don't what code to write in that. In every installation guide, they just assume that a configuration is already there. In documentations etc. they tell how to edit those fields and the way main class decides what to find in any program to execute. But I couldn't add a configuration to start executing any program.
I need help with the highlighted fields in the following screenshot
This guide from jetbrains.com didn't help:
I'm not sure but I get that first I have to create something like main.java and then add it in the main class field but I'm completely clueless about program arguments. Environment variables are optional I guess.
Please help. Thank You
Edit: Here's the file which I'm trying to use for main class field in the configuration.
public class Lbasic1 {
public static void main (String args[]) {
System.out.println("I make mistakes");
}
}
Edit 2: I don't get any option as Run Lbasic1.main() anywhere. Here is the screenshot of IDE
This question already has answers here:
How to find the real class name from obfuscated ProGuard classname in my source code?
(1 answer)
Android - How to check Proguard obfuscation has worked?
(5 answers)
Closed 1 year ago.
I am seeing a bunch of ClassCastException crashes in my project and the stacktrace describing:
java.lang.ClassCastException: j.u.v cannot be cast to kotlin.collections.MutableList
I can't seem to figure out or find what the j.u.v. stands for.
Anyone?
I overlooked for a moment that j.u.v. of course seems to point to an obfuscated classname..
As to #RyanM question. That post you linked to there isn't that helpful for most people. This one is way better: Android - How to check Proguard obfuscation has worked?
For who wants to figure out to what class the obfuscated classname refers to you can either check the mappings.txt file in the build -> outputs -> mapping folder.
Or another way to figure out to which the obfuscated file/method name relates to is use the apk analyzer (build -> Analyze APK)
yesterday i was trying to run a simple Java class, with a simple method void to print something, when i want to run that class i got something weird... either Eclipse IDE run a different class (a previous one) or don't run at all, just asking for a main class from that package... but why? I mean, if i create a new Maven project, or a new Class, i expect to run that class, but if i want to Run as -> and searching for Java Application, doesn't apper. Anytime i want to run something, either i neet to run that main class from that particular project/package created or Eclipse running a whole different class from a few days ago when all was good. The same thing i occur in tool Suite...
If you need some photos of configuration or something, feel free to ask, right now i don't know what to do...
Edit: I created a Maven project with a new Class, TestVoidClass with a void method that prints: System.out.println("Inside TestVoidClass");
So now i have two classes in my MavenProject, App class with main method who works fine and i can run that hello world print, and TestVoidClass, who doesn't work, doesn't appear to run as Java Application... bellow are some photos
First photo showing that it's running a previous class:
Second photo showing i can't find that Run as Java application:
Working with default App maven project main class:
make sure the class you want to run contains a main-Method. That is:
public static void main(String[] args) {...}
If a class doesn't contain this method, it can't be run. In your main-Method, you can call your Sysout() function.
If you open a class containing a main-Method, Eclipse will automatically run it when you click Launch.
I'm asking this question even though it has already been asked many times because I didn't find a solution after hours of searching.
I'm using Eclipse to learn Java. Last week everything worked properly. I could run whatever I wrote. Then today, I opened Eclipse, wrote some lines and when I tried to run it, I got an error:
Error: Could not find or load main class test.ArrayTest
Caused by: java.lang.ClassNotFoundException: test.ArrayTest
But that's not all : every project in my workspace is having the same issue. I can't run anything. At first I thought it was because I made a mistake at Eclipse start, so I closed it and re-opened it, but I was in the correct workspace.
I've tried to clean/rebuild it, doesn't work.
I've tried to mess with Properties > Java Build Path, doesn't work.
I've tried to create a new project with a simple 'Hello World', doesn't work.
package Hello;
public class Main
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
What I have in package explorer.
Console display.
The thing that suprises me the most is that I don't think I've done anything that can mess with Eclipse between the moment it was working and now.
Does someone have another idea ?
I think I found the root of the problem !
The path to my workspace was containing a letter with an accent ('Bibliothèque' by default with Windows 7+ in french...), so I tried to create a new workspace outside of it, and it worked !
I'm not a 100% sure it was really it, but since it worked, it's worth sharing.
Probably you have disconected JDK in project.
Try open conextual menu on project (right mouse button)
properties/Java Build Path/Libraries
check is correct JDK or remove
then: [Add Library] / JRE System Library/ Alternate JRE/ [Installed JREs] / [Add] / Standard VM / [directory]
select path to your JDK (not JRE) and confirm, select checkbox your new jdk and [Apply and close]
on select list choose your new jdk and [Finish] and [Apply and Close]
should works. I have sometimes this problems. It's Eclipse
Earlier when i am creating a new class for practicing programs in Eclipse. I use to create in same project and it used to run well. But lately i have to specially go to Run>Run Configuration> I have to manually select the project and main class.
Is there any configuration i m missing as this is time consuming to every time go and change the main class.
Can anyone help?
You can press the black arrow near the Run button to select what to run, usually you will find your classes with public static void main(String[] args) there. That's how it works for me.
The problem can be due to new class files not being generated due to errors. I have seen the same results as you (new changes not picked up) due to one or both of the following.
1) Look for red-! or red-X next to a project and fix the problem(s) in that project.
2) Check the Problems tab and fix all red-X errors.