How do you make Git work with IntelliJ? - java

I am going to use Git version control by IntelliJ Community Edition in order to make branches of the programs I intend to develop. I am striving to accustom myself to its functionality and I come accross obstacles.
I follow the instructions of the web-page http://wiki.jetbrains.net/intellij/Using_Git_Locally and although I do what it orders, when I reach Image5 I find an empty list under Default.
It is possible that it does not matter I thought, so I continued the procedure.
However when I come to most important section of Committing Changes to Master (Revision 1) the list is also empty and the commit changes does not detect any changes to my project (see Image13 and Image 14).
Apart from that, I receive a message when I open the project once more indicating that the Git execution path is not correct. But how can I get knowledge of what execution path should be appropriate so as to insert it?
Does anybody know a decent order of instructions (on a web site or by his won experience) which can guide me to how I can take advantage of Git functionality to incorporate it to my work? It is crucial for me to put my work through.

You need to specify the executable path of Git in the Git Settings, as mentionned in the per-requesites:
The Git integration plugin is enabled and the location of the Git executable file is correctly specified on the Git page of the Settings dialog box.
As long as you see "a message indicating that the Git execution path is not correct", the rest of the instructions won't work.
Path to Git executable
In this text box, specify the path to the Git executable file.
Type the path manually or click the Browse button to open the Select Path - Git Configuration dialog box and select the location of the Git executable file in the directories tree.
See "Where is git.exe located?" for the path of Git on Windows.
with Git for Windows:
C:\Program Files\Git\mingw64\bin
OR
c:\path\to\PortableGit-2.6.2-64-bit\usr\bin
OR
c:\path\to\PortableGit-2.x.\mingw64\bin
With GitHub Desktop:
%USERPROFILE%\AppData\Local\GitHub\PORTAB~1\bin\git.exe
Update 2020, three years later:
As noted by Daniel Connelly in the comments
IntelliJ now lets people install it through the path specified in the help above (just look for the "Download Now" button on the Git menu).
If you download Git from the website, a version that IntelliJ does not support will be installed.

GitHub for Windows on Windows 7 currently installs Git in a path similar to this:
C:\Users\{username}\AppData\Local\GitHub\PortableGit_93e8418133eb85e81a81e5e19c272776524496c6\bin\git.exe
The guid after PortableGit_ may well be different on your system.

On unix systems, you can use the following command to determine where git is installed:
whereis git
If you are using MacOS and did a recent update, it is possible you have to agree to the licence terms again. Try typing 'git' in a terminal, and see if you get the following message:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

On Window machine install any version of Git. I installed
Git-2.14.1-64-bit.exe
. Got to search program and search for git.exe. The file can be located under
C:\Users\sd\AppData\Local\Programs\Git\bin\git.exe
.
Open Intelli IDEA>Settings>Version Control>Git. On Path To Git executable add the path. Click on Test button. It will show a message as
Git executed successfully
Now click on Apply and Save. This will solve the issue.
.

git.exe is common for any git based applications like GitHub, Bitbucket etc. Some times it is possible that you have already installed another git based application so git.exe will be present in the bin folder of that application.
For example if you installed bitbucket before github in your PC, you will find git.exe in C:\Users\{username}\AppData\Local\Atlassian\SourceTree\git_local\bin
instead of C:\Users\{username}\AppData\Local\GitHub\PortableGit.....\bin.

For Linux users, check the value of GIT_HOME in your .env file in the home directory.
Open terminal
Type cd home/<username>/
Open the .env file and check the value of GIT_HOME and select the git path appropriately
PS: If you are not able to find the .env file, click on View on the formatting tool bar, select Show hidden files. You should be able to find the .env file now.

Literally, just restarted IntelliJ after it kept showing this "install git" message after I have pressed and installed git, and it disappeared, and git works

Related

SSE core task scheduler startup problem in eclipse

Whenever I'm launching my eclipse IDE with my project workspace, there is one popup window showing some internal error with the task scheduler. I'm attaching the picture of that popup window here.
My project is all in java language and also uses spring boot in it.
The error says something like
An internal error occurred during: "SSE core task scheduler startup"
Sorry I'm not able to add a direct image for this as Stack overflow is not allowing me to do that.
Maybe a missing or an outdated plugin. You should verify your ICU4J plugin version (menu: Help -> About Eclipse IDE -> Installation Details -> plugins).
If "Eclipse Orbit" plugin version is older than "Unicode, Inc" version check for missing/outdated software site and add/update "Eclipse Orbit" https://download.eclipse.org/tools/orbit/downloads/2022-09.
Then check for new updates or install ICU4J.
Running with temurin-18.jdk on MacOS, stack below.
Offending call to new StringTokenizer(..):
https://git.eclipse.org/r/plugins/gitiles/sourceediting/webtools.sourceediting/+/refs/heads/master/core/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/utils/StringUtils.java#777
Looks like an errant import from com.ibm instead of java.util.StringTokenizer:
https://git.eclipse.org/r/plugins/gitiles/sourceediting/webtools.sourceediting/+/refs/heads/master/core/bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/utils/StringUtils.java#27
import com.ibm.icu.util.StringTokenizer;
Stack:
!ENTRY org.eclipse.core.jobs 4 2 2022-09-22 08:11:42.471
!MESSAGE An internal error occurred during: "SSE core task scheduler startup".
!STACK 0
java.lang.NoClassDefFoundError: com/ibm/icu/util/StringTokenizer
at org.eclipse.wst.sse.core.utils.StringUtils.unpack(StringUtils.java:777)
at org.eclipse.wst.sse.core.internal.tasks.TaskScanningJob.getScannedProjects(TaskScanningJob.java:295)
at org.eclipse.wst.sse.core.internal.tasks.TaskScanningJob.projectHasNotBeenFullyScanned(TaskScanningJob.java:152)
at org.eclipse.wst.sse.core.internal.tasks.TaskScanningJob.addProject(TaskScanningJob.java:118)
at org.eclipse.wst.sse.core.internal.tasks.TaskScanningScheduler.enqueue(TaskScanningScheduler.java:137)
at org.eclipse.wst.sse.core.internal.tasks.TaskScanningScheduler.startup(TaskScanningScheduler.java:117)
at org.eclipse.wst.sse.core.internal.SSECorePlugin.lambda$0(SSECorePlugin.java:96)
at org.eclipse.core.runtime.jobs.Job$1.run(Job.java:166)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.ClassNotFoundException: com.ibm.icu.util.StringTokenizer cannot be found by org.eclipse.wst.sse.core_1.2.800.v202207121749
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:541)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:487)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 9 more
For me, Eclipse was almost working until these two updates occurred:
Mylyn WikiText 3.0.43.202209151832 org.eclipse.mylyn.wikitext_feature.feature.group Eclipse Mylyn
M2E - Maven Integration for Eclipse 2.0.5.20220912-1211 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e
The StringTokenizer error appeared immediately after Eclipse restarted.
(I emphasize almost because M2E was never copying the Maven Dependencies into the WEB-INF/lib of my configured server.)
This error caused lot of issues to me like unable to open jsp editor in Eclipse, multiple crashes when autocomplete is selected.
This is what i did..
First go to Menu Bar > Help > Install New Software > Manage Button in Eclipse.
Search for m2e. There may be one item with icon and without any name. Click on edit and then update the url to http://download.eclipse.org/technology/m2e/releases/latest . Click on Add and then Apply and close and then Finish.
As suggested by user #EG-IT,
Now Go to Menu Bar > Help > Install New Software in Eclipse. In the work with text area insert this link https://download.eclipse.org/tools/orbit/downloads/2022-09. If drop down menu appears then fine, If not add a space and press backspace now a drop down should appear.
Select the option with orbit - https://download.eclipse.org/tools/orbit/downloads/2022-09
Click on the Select All button on the right and click Next button. Select all items if prompted to install. Agree to term and conditions, wait till updates are installed. Restart IDE.
If same error persists please update the Eclipse.
I hope this detailed explanation works.
I had the same problem today.
Updating Eclipse solved it for me:
Help -> About Eclipse -> Installation Details -> Update
This is the exact same thing from the below link, if you want to know more check here
Run the System File Checker tool (SFC.exe)
To do this, follow these steps:
Open an elevated command prompt. To do this, do the following as your appropriate:
If you are running Windows 10, Windows 8.1 or Windows 8, first run the inbox Deployment Image Servicing and Management (DISM) tool prior to running the System File Checker. (If you are running Windows 7 or Windows Vista, skip to Step 3.)
Type the following command, and then press Enter. It may take several minutes for the command operation to be completed.
DISM.exe /Online /Cleanup-image /Restorehealth
Important: When you run this command, DISM uses Windows Update to provide the files that are required to fix corruptions. However, if your Windows Update client is already broken, use a running Windows installation as the repair source, or use a Windows side-by-side folder from a network share or from a removable media, such as the Windows DVD, as the source of the files. To do this, run the following command instead:
DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess
Note: Replace the C:\RepairSource\Windows placeholder with the location of your repair source. For more information about using the DISM tool to repair Windows, reference Repair a Windows Image.
At the command prompt, type the following command, and then press ENTER:
sfc /scannow
The sfc /scannow command will scan all protected system files, and replace corrupted files with a cached copy that is located in a compressed folder at %WinDir%\System32\dllcache.
The %WinDir% placeholder represents the Windows operating system folder. For example, C:\Windows.
Note Do not close this Command Prompt window until the verification is 100% complete. The scan results will be shown after this process is finished.
After the process is finished, you may receive one of the following messages:
Windows Resource Protection did not find any integrity violations.
This means that you do not have any missing or corrupted system files.
Windows Resource Protection could not perform the requested operation.
To resolve this problem, perform the System File Checker scan in safe mode, and make sure that the PendingDeletes and PendingRenames folders exist under %WinDir%\WinSxS\Temp.
Windows Resource Protection found corrupt files and successfully repaired them. Details are included in the CBS.Log %WinDir%\Logs\CBS\CBS.log.
To view the detail information about the system file scan and restoration, go to How to view details of the System File Checker process.
Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log %WinDir%\Logs\CBS\CBS.log.
To repair the corrupted files manually, view details of the System File Checker process to find the corrupted file, and then manually replace the corrupted file with a known good copy of the file.

Spring Tool Suite not completing sources and javadoc download

I have STS 4.11.1.RELEASE installed.
On the bottom right corner there's this message that keeps blinking and never stops:
"Download sources and javadoc: (66%)"
The message has been there for days.
Have restarted STS and the computer several times and that blinking message keeps there.
For some reason the download is not completing.
Have already added SpringToolSuite4.exe to the Windows Defender (which is the antivirus/firewall I'm using) allowed files list.
Have also tried completely turning off Windows Defender with no result as well.
Martin seems to be right. The problem seems to be caused by a corrupted local Maven artefact stored on your hard drive in the Maven cache.
Steps to fix are just to refresh your Maven cache by removing the repository directory.
Close eclipse (This step is required more on Windows due to file locking).
Delete your ~/.m2/repository/ directory (On Windows it's under C:\Users\<your user>\.m2\repository\).
Open eclipse.
If you want to backup the cache by moving it instead of deleting then use this:
# To clear the Maven (m2) cache:
mv -v ~/.m2/repository{,_bak}
# To restore if required:
mv -v ~/.m2/repository{_bak,}
# To delete the backup once you're sure you don't need it:
rm -rf ~/.m2/repository_bak
Once eclipse is launched it will re-download the Maven dependencies of all your projects from scratch into a new ~/.m2/repository/ directory. This may take some time depending on the number of dependencies and your internet speed. You can see the progress of the downloads in the progress pane.
Once it's done the progress pane should no longer repeatedly show "Download sources and javadoc".

not able to access JDK path in intelliJ in Jetstream XSEDE cloud

I am having issue when trying to associate my intelliJ project with JDK in JetStream Xsede cloud. Whey trying to access the directory through intelliJ, I can see a locked folder icon which don't allows to access it.
Steps that I followed to set the JDK in intelliJ:
Open project structure (CtrlAltShifts)
Go to Project Setting->project
Click on the new Button under Project SDK
Please let me know if any further information are required to recreate the issue.
I resolved this issue by performing
chmod 777 /usr/lib/jvm in the terminal.
Once I run this command, the lock design disappears, and the directory becomes accessible.
Thanks.
Prashant

How to save Java Project from IntelliJ IDEA to Git repo so it will build on another PC after cloning?

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.

How to update already installed IntelliJ IDEA on Ubuntu?

Currently, I have IntelliJ IDEA 2016.3 installed in my Ubuntu 16.04 for Java programming. I have installed it through the IntelliJ website and not the ppa. Upon launching it, I get an update available notification on bottom right corner and upon clicking update, it opens the IntelliJ IDEA webpage for downloading the latest IDE tar file. I know that in order to install it, I need to download the tar file, untar it inusr/local, and run idea.sh from the bin folder. Even after doing that, when I search for IntelliJ in the Unity Dash, I see the icon for the old 2016.3 version and upon clicking it, it opens the same old version.
So my question is, how can I update the entire existing IntelliJ platform and see it as the result upon search in the Unity Dash? Can I update it in the same way in which I can update the existing plug-ins and see them in effect upon restarting IntelliJ?
I recommend using Toolbox App for the seamless automatic updates.
If you have upgraded manually, use the Tools | Create Command-line Launcher and Create Desktop Entry to update the old ones.
I also suggest to use ToolBox but in case it is not an option, I just upgraded from IntelliJ 173 to 181 in Ubuntu 16.04 manually and I did it like this.
Download the new IntelliJ version's .tar.gz file from Jetbrains
website
Untar the file and put all of its content to the desired location. I put mine in /opt folder for example: sudo tar -zxf ideaIU-2018.1.tar.gz -C /opt
Go inside the new IntelliJ's folder and run the idea.sh script. Example:
cd /opt/idea-IU-181.4203.550/bin then ./idea.sh and follow the instructions (select the option to import your settings from your previous Idea's version).
At this moment you have two versions installed but you run the old one when clicking on the Idea icon from the launcher. The problem is that the file (with extension .desktop) that sets up the launcher's icon still points to your old version. You can change that.
The desktop file may be in ~/.local/share/application or /usr/share/applications. Mine was in ~/.local/share/application and its name was jetbrains-idea.desktop.
Edit jetbrains-idea.desktop file with your favorite editor and change the values that need to be changed. In my case I only had to change the values of "Icon" and "Exec" properties. Check the real path from your IntelliJ's installation folder (what we did in point 2 above). Example below of my modified .desktop file:
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA Ultimate Edition
Icon=/opt/idea-IU-181.4203.550/bin/idea.png
Exec="/opt/idea-IU-181.4203.550/bin/idea.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
Save the file and check that its syntax with the command desktop-file-validate pathOfYour.desktopFile (no output means all is fine).
Update your system with the latest changes for .desktop files: sudo update-desktop-database.
Check that the icon from the launcher now launches the new version of IntelliJ. If it does not, log off and log on from Ubuntu. That should do.
You can delete the directory of your previous IntelliJ's version + its hidden directory in your home folder.
You may want to update the values of the executable file /usr/local/bin/idea (if it exists) to point to your new version.
In case anyone still needs an optional solution.
First of all, just install the new version IntelliJ as the first three steps of #Stephane B.'s solution
Download the new IntelliJ version's .tar.gz file from Jetbrains website
Untar the file and put all of its content to the desired location. I put mine in /opt folder for example: sudo tar -zxf ideaIU-2018.1.tar.gz -C /opt
Go inside the new IntelliJ's folder and run the idea.sh script. Example: cd /opt/idea-IU-181.4203.550/bin then ./idea.sh and follow the instructions (select the option to import your settings from your previous Idea's version).
At this moment you have two versions installed but you run the old one when clicking on the Idea icon from the launcher.
To start the new version intelliJ from the launcher:
In the new version IntelliJ, click Configure -> Create Desktop Entry. Now you can start new version from the launcher.
(Optional) You may want to delete the old one. sudo rm -rf /opt/idea-xxx-old-version-xxx
If you are an admin on your system, you are usually in the sudo group
# This will change the group of Intellij folder, subfolders and files to a
# likely existing admin group `sudo` that you will likely be apart of as an admin.
sudo chgrp -R sudo /opt/intellij-idea-community
# Add `+` `w`rite permission for `g`roup for the Intellij folder, subfolders and files
sudo chmod -R g+w /opt/intellij-idea-community
Now you should be able to run the update from the UI (Tested successfully on Ubuntu 14.04).

Categories

Resources