I installed a plugin named, "Optimizer for Eclipse".
I clicked the Disable verification button.
This now doesn't allow me to run files without building the project.
Everytime I run a java project, If it is a new file. It says cannot find or load main class.
If I build the project and then run it runs.
If I change the file and again run it. It runs the previously compiled file.
How do I re-enable class verification in Eclipse?
Suffered the same problem.
Go into your Eclipse folder, open eclipse.ini with your text editor.
Delete the following line:
-Xverify:none
Then, restart your IDE, the verification will come back.
Changing the workspace works!
All the settings are gone in the new workspace and it's totally new.
Related
Anytime I try to run a java file by clicking run, it instead tries to run the class file and thus gives a no main method error.
When I try to right click on a java file and run that, it doesn't recogize it as a file that is runable.
I am still able to run programs from the command prompt but I would prefer to be able to run them in IntelliJ.
This occurred after trying to create a Class path when using JSon Libraries.
Edit:
Normally it shows java files with this icon:
But instead it's showing this icon for java files:
I think the change in icon might have something to do with it.
Edit 2:
the exact error I get is "C:\Program Files (x86)\Java\jdk1.8.0_181\bin\java.exe"...bunch of other program file locations
Error: Could not find or load main class sample.Main
Process finished with exit code 1
I had the same problem and found out that my src wasn't marked as Sources Root. To change this:
right-mouse click on your src
navigate to "Mark Directory As"
choose "Sources Root"
It will now recognize your files correctly and your main classes will be able to run again
IntelliJ not recognizing my .java-files
Problem solved
I had a similar problem.It wouldn't pick up ModlServer in any project. (Not just limited to the one I had open).
I had to file -> Manage IDE Settings -> Restore Default Settings
Note: I lost all my live templates, fonts, etc so just a heads up.
I restarted my computer and that somehow fixed it.
My issue was that I have multiple modules for my project and the module I was working on (where java files were not recognized) was not included in the main pom. I just added that module in the main (project) pom and it worked.
Right click on the project and click 'Add framework support' all directories and classes should now be the right type.
I've fixed this at Intelij2023 by using JDK17 as the JDK the IDE uses to import java source files.
Mind this JDK version does not need to be the same you use to build your project.
Go to: Settings > Build, Executio, Deployment> Build Tools > Maven > Importer
Set the JDK For Importer to zulu-17
I'm using zulu-17 as JDK for imports and coretto-8 to build the project (having JDK version 8 seems to be preventing intelij to properly recognize the project structure)
If you are using Maven or Gradle, try to re-import the project and see if that helps. Could be that your IDEA project has some incorrect settings in it set by mistake, so this way those would be removed.
I'm building a simple calculator app from a tutorial/class on Pluralsight (Java Fundamentals class), which starts with a Main.java file, and adds a class file later, MathEquation.java.
I created a Git repo to track my progress, and uploaded to Github: JavaFundamentalsClass. I used GitIgnore.IO to find a Java IntelliJ .gitignore file, and everything seemed to be working fine on the original PC I was using.
However, after switching over to a different PC, with a fresh install of IDEA, I cloned down the repo from Github, and found that the project would not build and/or run. I get this error:
"C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.191-1\bin\java.exe" -Dfile.encoding=windows-1252 -jar ""
Error: Unable to access jarfile
Process finished with exit code 1
I suspect that there is something in the .gitigore file that is keeping some of the project, dependency, or build information from being saved in the repo that keeps IDEA from having all the info it needs to build and run the Main.java correctly.
Can anyone help? You should be able to download the project from the repo linked above in it's currently broken state, including the .gitignore file.
Additional Info
I wiped my repo clean and recloned and I forgot, originally it doesn't even give me the run button (it is grayed out). I had to do a procedure with "Add Configuration" from a search I did for that to show up to get the error above.
Also, I did install java from the OpenJDK, rather than oracle. I figured with Oracle cutting off commercial development maybe start the switch now as I'm learning, but maybe that's the issue (normal Java on my other PC).
It's working, but...
First thing - Intellij needs to know where Java is. It appears that if the SDK/JDK is not installed prior to Intellij, you will need to tell it where Java is after installing. Or if you use OpenJDK instead of Oracle Java SDK. You can do that at View/Open Library Settings, under Platform Settings / SDKs (select the JDK home path).
Then, after setting up Java, I am able to get everything working in Intellij IDEA if I find the Main.java file, right-click, and choose "Run main.main()". This runs the program okay, and also creates a Main configuration in the Run/Debug configuration area, and finally the "Run" button becomes available.
So I can get it working, but if I wipe all the files and clone it fresh from the remote repo, I have to go through running the Main.java file directly again to recreate the configuration.
So, this still doesn't answer my original question. Why doesn't this configuration get saved in the repo? What file is this information saved in? Is there something in the .gitignore file that is keeping this information from being saved to the repo?
Look like you have a different java version on your second machine.
First of all, check your java version
Update the configuration of your project, right now it pointing to java 1.8
https://github.com/LightCC/JavaFundamentalsClass/blob/master/.idea/misc.xml
I think it might be because of java not installed on the other PC you were trying. If it is installed just check whether the path mentioned has java executable file.
The first part is ensuring Java is setup, and that Intellij IDEA knows where Java is, per the other answers, comments, and addendums to the question.
The second part is setting up the run/debug configuration, per the "It's working but.." section of the question. This can be created automatically by right-clicking the file that has the main class to be run (usually Main()...), and selecting the "Run Main.main()" option (replacing Main and main() with the file and function which needs to be run)
The final piece is that to get the run/debug configurations to save to the repo, you either need to:
Share the workspace.xml file (i.e. make sure this is not in the .gitignore file). However, there is a lot of user-specific stuff in that file, so it should normally be excluded from the repo.
Or, edit the configuration and checkmark the "Share" box in the upper right-hand corner (just right of the "Name" field). This will put the configuration into a separate folder inside the .idea folder, which should not be excluded from the repo by .gitignore.
Can anyone help me with this error:
java was started but returned exit code = -805306369
C:\Windows\System32\javaw.exe
-jar C:\Program Files\Java\eclipse-jee-helios-SR2-win32-x86_64\eclipse\plugins\org.eclipse.equinox.launcher_1.11.1.R36x_v20101122_1400.jar
Just had this issue, for me it was a corrupted workspace osgi cache. The solution was to run eclipse with the -clean parameter as
eclipse.exe -clean
After some time, eclipse required to clean up, the workspace selection dialog popped up and I could start eclipse normally again.
The -clean parameter is documented in the eclipse help
My problem was a corrupted workspace the solution was from Rob's link:
http://spacetech.dk/eclipse-failed-java-was-started-but-returned-exit-code-805306369.html
I started getting the same error "exit code = -805306369" just out of no where.
Eventually I looked at the Eclipse logs at the <workspace_directory>/.metadata/.log and realized that my Source Control plugin (Perforce in my case) was unable to connect and the eclipse was stuck.
This was because my eclipse was piggy back(depending) on the client connection that I have with my Perforce windows client and my Perforce client was not connected to the server. I connected my Perforce client and the eclipse started working normal.
this happens when mostly workspace is corrupted..... cooler solution is just to switch the workspace to safer location(new location).... and just import the project from previous workspace... princess can still be saved....
For me , Just change your Workspace to another one
I got this error, when workspace already setted up. Since the java virtual machine cannot be created. try command: java -version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I restarted my machine, and it solved my problem.
One of the class file in my project was corrupted. The name of a class file was too long and I was not able to delete or rename it, so I rename the folder containing it and then I was able to delete the project and that solved my problem.
Now i know that my workspace was corrupted, it solved my problem.
Go to your workspace and rename it.
Start your eclipse and by default it will create a workspace.
Go to File -> Switch Workspace, choose your original workspace.
I wasn't able to disable "Automatically find new updates and notify me." The option was not there on the Install/Updates page. Perhaps eclipse workbench has changed since that answer was written.
However, running eclipse with the -clean option in my old workspace did the trick for me. The way to do that in windows is to first find the directory where eclipse.exe lives. You can go to the start menu and in the "search menus and files" bar, type eclipse. You should see the purple globe icon pop up under "Programs." Hover your mouse over it and it will tell you the directory it exists in.
Then... open "computer" or some other window from the start menu and from there navigate to the window where eclipse is. Click your mouse in the bar at the top where the directory is displayed (somewhere not on the text). That directory will highlight. Now type cmd. A black command window will open and you will be in the directory where eclipse is. At the command prompt (drum roll) type eclipse.exe -clean
eclipse will start. Make sure it is asking to go to your corrupted workspace and click OK.
Wait for it and soon you will know if your workspace has been uncorrupted. Yay!
“java was started but returned exit code = -805306369” caused by Eclipse´s currupted workspace, I solved my problem with this 4 steps:
1) claose the eclipse.
2) Kill the adb from task manager.
3) Start your eclipse and by default it will create a workspace or start with new workspace.
4) Go to File -> Switch Workspace, choose your original workspace.
In my case, it is a work laptop, so pretty secure SOE
64 bit Win 7.
Unzipped Eclipse MARS onto a folder on "C" drive
Install failed consistently with Java error code -805306369
Created a separate folder on 'C' drive for workspace, granted
everyone full-control and that fixed it!!
I got same issue when opening files using shortcut - Ctrl+Shift+R.
I got it resolved by disabling "Automatic Updates".
Steps to disable automatic update in eclipse (helios): Windows >> Preference >> Install/Update >> Automatic Updates. Disable "Automatically find new updates and notify me".
How I managed to get mine working. I used a combination of the solutions above. It works for me.
Step 1: Change your workspace to some other names e.g. change it from workspace to workspace1.
Step 2: Access your eclipse and stop automatic updates (provided that you could access after changing your workspace)
Step 3: Exit your eclipse with workspace1
Step 4: Start your eclipse with former workspace by entering eclipse.exe -clean (if you are using others then use e.g. MuleStudio.exe -clean)
In conclusion, using a combination of solutions such as changing workspace, stop automatic updates and -clean work for me. Try it yourself.
When I run an Ant build, MyEclipse (happens for v6.0 and 7.5) formats my code. When I open the file it says it was modified on the file system and when I reload it it is formatted.
The thing that is even stranger is that it is not formatted as specified in the Code Style in my Preferences (seems like Java Sun codding rules).
As far as I could determine, there is nothing called by the Ant build to do the formatting so it MyEclipse doing it? Could it be a plugin or something?
Part of the build also includes Maven tasks so could there be a Maven plugin doing this?
I mention that I searched and deactivated all possible options in the preferences of the IDE trying to find some setting but nothing.
It is very annoying so far and could cause problems since I am working on some older projects with minimal modifications in the code and don't want to have a complete messed up version of a class just because I modified a word or something.
Has someone else encountered this?
P.S. It happens only on my PC. My colleagues don't encounter this issue.
Thank you!
EDIT: I have executed some tests:
I executed the Ant script outside of
eclipse (in command prompt) then
opened the files with notepad. The
files are untouched, no formatting
occurred. If I open eclipse nothing
happens to the files.
I opened eclipse and changed the files on the disk using notepad (added some spaces and saved them). Eclipse says the files are changed on the file system and asks to reload them. I say Yes he opens the files. The files are unchanged. No formatting occurs.
I run Ant from eclipse. Eclipse says files have changed and asks to reload them. I say Yes and when the files are opened they are formatted. WTF??!?!!
Is there a config that says to run some tasks after ant builds or something? I could not find anything.
Did you check the "Save actions"?
Preferences" menu, Java > Editor > Save actions.
One of the possible actions is to format your code when you save. You can have these preferences on a global or per project context.
Although it's strange that the code gets changed when you run your Ant script.
Eclipse can format on save if you choose, and you can elect to have it save automatically any modified files before a build. There is nothing in myeclipse that would cause the code to be formatted on load. I would look through your plugins.
Jalopy has an ANT plugin that will format code
A previously working Ecplise now gives me the error
Java Virtual Machine Launcher
Could not find main class: testing2. Program will exist.
testing2 is my class and a source file exists but Ecplise doesn't seem to build the .class file.
Maybe I hit the wrong hotkey and changed accidently some setting?
As Bozho said Build Automatically should be checked which builds your project on every save of your source file.
If it is unchecked then you have to manually build the project by right clicking on it and select Build Project.
The following menu item should be checked : Project > Build Automatically