I am pretty new to coding & working with IDEs. Intellij prompted me for an update, which I allowed. Now I cannot run my scripts from the Intellij terminal.
The error message I receive is
"Error: Could not find or load main class src.MatrixHomework.java"
My pathway hasn't changed... it's still
C:\Users\General_Sherman\IdeaProjects\Assignment3\src\MatrixHomework.java
I updated to IntelliJ IDEA 2019.2.1
Build: IC-192.6262.58
I'm using jdk-11.0.2
This is most likely due to the selected directory configuration. IntelliJ uses the configuration under Tools/Terminal in your settings to select what directory to start in. You haven't provided any screenshots, but if this doesn't work, type pwd into the terminal and share it here, we might be able to see the problem.
Regardless, you shouldn't be running your programs through the integrated terminal, and instead via the "Run" tab in the top right. Remember to edit the configurations and add C:\Users\General_Sherman\IdeaProjects\Assignment3\ as a part of the Working Directory argument. This is what a configuration would look like.
Related
This question already has answers here:
IntelliJ Build Error Context Mismatch
(14 answers)
Closed 5 years ago.
One of my IDEA installations has stopped running my Gradle run configurations. The run configuration is for a regular Java app submodule in my project (the module is called "server"), and the run configuration is as simple as it can get:
Gradle Project: /path/to/server/build.gradle
Tasks: run
No VM arguments, tool windows or any other configuration.
When I run it, I get this:
with no other output. It is not failing on my other machines that are running the same version of IDEA against the same checkout of the same source repository.
I am running the latest IDEA for OS X, 3.5. I tried downgrading to 3.4, by deleting my 3.5 app and installing 3.4 from scratch, and I got the same error running my configuration.
I have tried (many times) invalidating the caches and removing the out/ directory. When everything is recreated, I get the same error.
I've tried deleting the run configuration and recreating it. Same error.
I've tried creating different Gradle run configurations for other submodules in my project. Same error when I try to run them.
I can switch into any of my submodules and type "gradle run", and they run just fine. It's only in IDEA that they can no longer run.
Update: I edited my run configuration, switched to the Logs tab, and enabled "Save console output to file", sending it to /tmp/idea.txt, and got this error:
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home,daemonRegistryDir=/Users/user3562927/.gradle/daemon,pid=52404,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=ec6aa2e2-e5c9-4857-b08b-1e79fa37a332,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/user3562927/.gradle/daemon,pid=53135,idleTimeout=60000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Not sure why IDEA is not able to show me this information in the "4: Run" pane.
At least I know this is JDK-related now. I've tried updating my JDK in my project structure, and various other remedies suggested on this site, with no luck yet, but I'll keep trying.
I deleted all JVMs on my machine and painstakingly switched my project and module SDKs all over to the sole remaining JDK. No luck.
Then I noticed this little icon in the upper-left corner of the Run pane, which, when clicked, gave me the build output:
It looks like there are garbage characters in my JVM spec. The only place it is defined is in ~/.gradle/gradle.properties, so I deleted that file (even though there were no garbage characters in it). After that I'm back to the "The newly created daemon process has a different context" error.
After trying many many other things, I finally deleted my project's .idea directory and recreated it. This finally made the problem go away.
JetBrains really needs to get a handle on this problem. I had to recreate my dictionaries, my code style settings, etc. The IDE should be handling the presence of multiple JDKs without choking like this.
I'm having a frustrating issue with a java program I have been working on. I have not had this issue often in the past and I have actually created many versions using this same code and had no problems.
Suddenly, executable JARs of this program will not start. I have tried running them through the command prompt with Java and I get message about the main class not being found.
I have done a search here and none of the answers work for me. I have tried the following:
Removing the system library in the build path settings and adding it back. (The system library is [jre1.8.0_66]).
Changing the compliance settings from 1.7 to 1.6. I don't have an option for 1.8 and the JDK check box that says "Use compliance from execution environment on Java Build Path" is disabled.
Removing the main class and adding it back.
Using the package and export options for libraries.
I'm really not sure what else to do. I've tried doing a rebuild on the project many times and also tried restarting eclipse and re-exporting. I'm certain that I am selecting the main class when in the export preferences.
Any help or suggestions would be greatly appreciated as this has become very frustrating.
From the comments, it seems to me that you are not executing your JAR correctly. As stated in the comments, you are executing your JAR with java {jarname}. This syntax would only work with running a compiled Java class with a main method. To run a JAR, use:
java -jar {jarname}
I have a project in Java which get a file using smb client. When I edit this code and run it again in Eclipse, it is not running my modified code but running the same old one.
Checklist:
I saved the file and made sure there are no write errors.
Build Automatically is enabled.
Run configuration is configured properly.
There are no unresolved errors.
what am i doing wrong?
To find out whether Eclipse has really compiled your code, have a look into the bin/ folder of the project and check the date of the .class files in there. You will have to do this outside of Eclipse since it hides the content of this folder by default.
Use "Clean Project" to force a rebuild.
If that looks correct, the next step is to go to the Debug Perspective. Open the Properties Dialog for the process. Eclipse will then show you the classpath that it used to start the process. Make sure the paths are correct.
Delete bin folder data and clean project. To clean project:
Go on Project-->Clean-->select your project-->clean-->build project
This will solve your problem, if this does not work, please write a Hello world program and check this works or not. If this is also not working, check your Eclipse
I developed an Eclipse plugin that compiles and runs java code in German. The technique I am using is that I translate the code to English and pass it to Java Compiler and get the results back and print it in the console.
The problem is that the plugin works when I run the plugin from Inside Eclipse but when I install the plugin in Eclipse so that when I open Eclipse it already exists there and start to test if a real user uses my plugin and creates a new Java project and try to the compile button in my plugin it says [The chosen operation is not currently available] ![Here is the the way I run and it opens a new Eclipse application with the installed plugin ]
Any help please
the way you installed your plugin sounds a little weird to me. So at first please try to export your plugin via the Export Wizard.
(Select Export -> Deployable plugins and features from your projects context menu)
Export your project as jar file and copy it to the 'plugin' folder of your eclipse instance.
After that it might be helpful to debug your plugin on OSGI-Level as there might be a problem loading your plugin (at least the error description you have posted indicates that).
Run eclipse with -console -noExit -consoleLog flags to open an OSGI console for debugging. After that try running ss <your-plugin-name> to see what the state of your plugin is.
The output gives you the ID of your plugin and the state it currently has. If the state of your plugin is not ACTIVE try running start <your-plugin-id> to see whether it starts correctly. If there is a problem starting your plugin you should get a respective log message. Feel free to post it here in case you need further help.
Otherwise there are plenty of options what might cause your problems, so maybe its better to try the steps I have described above before getting into details.
If you want to run eclipse plug-in withput using Eclipse Application , then you need to make a Feature project.
Now if your algorithm has something to do with system Path , you must
check Unpack plug-in and you should read the resource accordingly.
Like PLatformUI.getWorkBC() etc..
No other eclipse plug-in (jar) should be inside plugins directory of eclipse of same name of your plug-in. Ensure for this.
I reinstall my Eclipse environment every year when the new version is released. The most recent release - Juno - however, does not work as expected.
Currently, when I try running demos from Oracle, for example, it asks me to select an Ant file to run before compiling. After creating a blank Ant file to bypass the requirement (which I thought was rather dumb, since I don't think TDD is something that should be forced on people), it still refused to run, saying the "Selection could not be launched."
I understand that Juno is an update from the 3.x track to the 4.x track, but this seems a little ridiculous to me. What can or should I do so I can get Eclipse back up and running again?
Just to clarify:
All files in question are on my Eclipse workspace path
I don't do much in the way of Java development, though I know I'll need to do so soon. Hence, my unfamiliarity with the most recent version of Eclipse.
I would like to run my files & projects without Ant files. I know it has something to do with Run configs, but I don't know how to change them.
Here's what I did to run the demo from Eclipse Juno:
Downloaded the project from http://docs.oracle.com/javase/tutorial/uiswing/examples/zipfiles/components-FrameDemoProject.zip (if this is not the correct demo, then please provide the link you're using)
Unzipped it to my projects directory (not my workspace), so that you have:
PROJECTS_DIR/components-FrameDemoProject/src
PROJECTS_DIR/components-FrameDemoProject/nbproject
PROJECTS_DIR/components-FrameDemoProject/build.xml
From Eclipse, File > New > Java Project
List item Uncheck Use default location and navigate to <PROJECTS_DIR>/components-FrameDemoProject
Hit Finish
Drill down to src/components/FrameDemo.java
Right-click on FrameDemo.java and select Run As > Java Application
Let me know if any of these steps give you trouble.
Take a look at you project properties and select the Builders entry. Do you see an Ant Builder entry? Try to select or create a Java Builder entry instead.
I just created a new Java Project in Juno and added the FrameDemo.java source. In my case, the Java Builder was selected as the default for this new project.