Showing posts with label Troubleshoot. Show all posts
Showing posts with label Troubleshoot. Show all posts

Wednesday, December 22, 2021

4 Solutions To Uncaught ReferenceError: $ is not defined jQuery Error

1. Overview


In this tutorial, We will be discussing how to solve the famous jQuery error "Uncaught ReferenceError: $ is not defined jQuery Error" that occurs for every developer who started working on jQuery API.

More on JQuery

This error comes into existence if you are trying to use a $ variable that is not defined yet using the var keyword. In jQuery world, it's a short name of jQuery() function and most commonly used in $(document).ready(function()). When dom is loaded, you are making some stuff using jQuery then there might be chances of corrupting the jQuery library or jQuery file location. This indicates with an error saying "uncaught reference error $ is not defined". This is the most generic error even if you are working on Angular Js, Ajax, Html, and MVC, laravel or rails .. any framework that is related to javascript. Because all of these are built on top of JavaScript.

In my experience, I have seen the junior developers or whose background is java, .Net, C#, Android technologies, and these developers is not having enough knowledge of JavaScript. JavaScript understanding is a must to work on jQuery or any JavaScript framework such as Angular, React or vue.js or ember.js. Once you know the basic concepts of JavaScript, you can troubleshoot any problems easily.



Gradle - could not determine java version 11.0.8 or any version [Fixed]

1. Overview

In this tutorial, We'll learn how to fix the gradle error "could not determine java version" from 9.0.1, 11.0.8, 11.0.12, 13.0.2, 14.0.2, 15.0.1 or 16.0.1 or any versions.

This is the common error that you face when working with the Gradle and you have the right java version also on the machine.

This solution will work for any java version or Gradle version.

[Fixed] Java lang exceptionininitializererror com sun tools javac code typetags

1. Overview

In this tutorial, We'll learn how to fix the error "Java lang exceptionininitializererror com sun tools javac code typetags" when working with maven build.


Java lang exceptionininitializererror com sun tools javac code typetags

Monday, December 13, 2021

Java Insert Dimensions To Complete Referencetype [Fixed]

1. Overview

In this tutorial, We'll learn how to fix the common compile time error "Syntax error, insert "Dimensions" to complete ReferenceType" in java.

This error occurs when you are working with the java generic types.

It is suggested to follow the generic naming conventions and rules with collection api.

Compile time error

Syntax error, insert "Dimensions" to complete ReferenceType.

At the end of the article, we've given GitHub link for the examples shown in this post.

Java Insert Dimensions To Complete Referencetype [Fixed]

Tuesday, November 30, 2021

[Fixed] Another git process seems to be running in this repository git in 6 ways

1. Overview

In this article, We'll learn how to fix the git error "Another git process seems to be running in this repository" in windows and mac operating systems.

When you are a beginner or working a git project, you get this type of error.

This error is saying git commands are locked by another git process for the current git application. Somewhere you are running two git commands at the same time. Simultaneous execution of git commands lead to error - Another git process seems to be running in this repository.

Another git process seems to be running in this repository


[Fixed] Git error: failed to push some refs to in 5 ways

1. Overview

In this tutorial, We'll learn how to fix the git error failed to push some refs to in 5 ways.

Most of the time you get this error while pushing your change git remote repository.

This might be working a few days back but suddenly started showing a weird error message "failed to push some refs to".

You are stuck at this point and do not what to do now. And you might be thinking because of my new changes?


For this error, there are mainly two reasons.

a) Your branch is set to main and not master
b) Remote repo has new changes and you do not have those changes on your laptop or local branch

Now, you knew about the actual reasons to get this common error.

Let us jump into the fixes.

Git error: failed to push some refs to

[Fixed] fatal: not a git repository (or any of the parent directories): .git in 2 ways

 

1. Overview

In this tutorial, We'll learn how to fix git error "fatal: not a git repository (or any of the parent directories): .git" on windows or mac os or Heroku.

Fixing this error can be done in 2 ways. But first, let us understand the error what is the meaning of the error.


fatal not a git repository (or any of the parent directories) .git

Monday, November 29, 2021

How To Enable HSTS Header? How to Implement custom HSTS Filter in Java with Examples?

1. Overview:

In this post, We'll learn how to enable/add HTTP Strict Transport Security (HSTS) Header to Tomcat 8 using a built-in filter. And also discuss how to add a custom HSTS filter in a java web application.

Learn Enabling/Adding HTTP Strict Transport Security (HSTS) Header to a Website in Tomcat or Any Server


As well as a solution to add HSTS to any web-site using web.config.

At last, will talk about the testing methodology to make sure HSTS is enabled for a website.

About HSTS:


HTTP Strict Transport Security (HSTS) instructs web browsers to only use secure connections for all future requests when communicating with a website. Doing so helps prevent SSL protocol attacks, SSL stripping, cookie hijacking, and other attempts to circumvent SSL protection.

Enabling HSTS Header

[Fixed] Git - remote: Repository not found in 9 ways (Windows and Mac)

1. Overview

In this tutorial, we'll learn how to fix the "Git - remote: fatal Repository not found" issue in 9 different ways.

You might have seen this error while cloning the repository or while pushing the commits to the remote repository.

This error can be fixed in simple ways.

[Fixed] Git - remote: Repository not found



2. Fix 1 - Git - remote: Repository not found


If you are new to programming and developing then you might have not set remote repo URL on your local repo. And trying to push the changes to remote.

This is needed when you downloaded the project as a zip file.

In this case, you need to set the remote base url to the local repo using the "git remote" command.

More on Git Commands

Follow the below steps.

git remote set-url origin https://github.com/JavaProgramTo/Kotlin-Demo.git

git add *.java
git commit -m "commit title"
git push origin master


3. Fix 2 - Git - remote: Repository not found


If the above is not your case, then you need to make sure that the remote URL is the correct one is pointing out.

Use git remote command as below.

git remote -v
origin	https://github.com/JavaProgramTo/Kotlin-Demo.git (fetch)
origin	https://github.com/JavaProgramTo/Kotlin-Demo.git (push)

If it is showing the right URL then verify it on remote whether it is the correct one or not. If not the correct one then you need to follow fix 1 to set the correct remote repo.


4. Fix 3 - Git - remote: Repository not found


Verify if your password has been reset recently. If you have changed so please make sure the new password is fetched from the credential manager on windows or keychain access on mac.

Sometimes, an old password will be used and a new one is not cached yet.

In this case, Remove all github.com credential details from the system. 
you need to clear the git related info from the credential manager and remove it from keychain access.

On windows

Follow the below commands on windows. After this, you should be able to push and pull the changes.
$ git credential-manager uninstall

$ git credential-manager install


On Mac machine

Open Keychain Access and find your password account in the password category ( you can search it on the top right keychain access page)

Once you find it, delete all keys related to your git source control and then try it again from the clone.

Before this take the backup of your uncommitted changes.


5. Fix 4 - Git - remote: Repository not found


This is a temporary fix and not recommended for the long term.

On Windows

  • Go to the git folder and go inside the .git folder
  • Open 'config' file using notepad or any other editor
  • Change your URL from https://github.com/username/repo_name.git to https://username:password@github.com/username/repo_name.git
  • Save and Push the code, it will work.
Here, you need to save the password and security threat.

On Mac

If the GitHub entry is not present in keychain access then you can clone the app in a different way as below.
git clone https://username@github.com/org/repo.git

Follow the below steps.

  • username with your GitHub username
  • org with your organisation name
  • repo with the repository name

6. Fix 5 - Git - remote: Repository not found


Just run the git remote update command which updates the local repo with the remote repo and its credentials.

If this command is executed without any issues then your issue will be resolved.
git remote update


7. Fix 6, 7, 8, 9- Git - remote: Repository not found


There might be chances of any one of the following.

7.1 If you are not a collaborator, then you may successfully authenticate the GitHub but can not clone or push the changes to the repository as long you are not a collaborator.

7.2 In case of any spelling issues

7.3 If the git remove -v has set to HTTPS but your repo is pointing to the ssh. In this case, you need to remove the ssh and add HTTPS.

git remote remove origin
git remote add origin https://github.com/JavaProgramTo/Kotlin-Demo.git

7.4 Remote repository is not found and deleted.


8. Conclusion


In this article, we've seen all versions of fixes on git error "fatal: repository not found error".


Git Delete Local Branch and Remote Branch (With Force Delete)

1. Overview

In this tutorial, We'll learn how to delete the local branch and remote branch in git with normal and force delete options.

Git provides easy access and manages the git local branches. And also provides exceptional support to remove local branches without any exception.

Removing git local branches can be done in two ways and removing remote repo in one way with commands.

Git Delete Local Branch and Remote Branch



let us look one by one now.

It is very useful to know Git Commands.

Monday, November 22, 2021

Building First Spring Boot REST API Application (Hello World Example)

1. Overview


In this tutorial, You'll learn how to create the first spring boot application in Spring Boot. This is like spring boot Hello world example. You will learn today how to create a spring boot rest API application from scratch step by step.

Building First Spring Boot REST API Application (Hello World Example)


Spring Boot is a subproject initiative done by the spring core development team. It manages internally many things for us automatically such as managing dependencies, spring traditional configurations, deploying in embed tomcat server and hosting as rest API.

Spring Boot 2.2.1
Java 1.8

Sunday, November 21, 2021

[Fixed] org.apache.tomcat.util.bcel.classfile.classformatexception: invalid byte tag in constant pool: 19

1. ClassFormatException: Invalid byte tag in constant pool: 15 Overview


In this tutorial, We'll learn how to fix org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15. This is a common issue while working with Tomcat 7 or Tomcat 8 version. We'll provide you the various solutions to fix this error permanently.

Addition to this issue, you can find the other set of trouble shooting problems.

[Fixed] Java 8: Invalid byte tag in constant pool: 15 or 19 - Tomcat

Common issues on the same error. The solution is common in all cases.

Invalid byte tag in constant pool: 15
Invalid byte tag in constant pool: 16
Invalid byte tag in constant pool: 18
Invalid byte tag in constant pool: 19


[Fixed] Tomcat 7+ Java 8 : Invalid byte tag in constant pool: 15


Let me tell my store with this problem and how did the troubleshoot this issue.

org.apache.tomcat.util.bcel.classfile.classformatexception: invalid byte tag in constant pool: 19



I have started working with java version 1.7 and Apache Tomcat/7.0.12. After some time my mind was completely changed. Felt very curious really waiting to work with java 8 features.

Read the article on Java 8 Lambda Expressions Feature

Friday, November 19, 2021

Uninstall Java on mac os with commands [Fixed]

1. Overview

In this tutorial, we'll learn how to uninstall java version from mac os.

To remove java from mac machine, you can use simple commands.

A) How to remove all versions of java installed on mac
B) How to remove java 11 from mac os.

The second option will work for any java version of mac. It can be either java 7, 8, 10, 11, 1, 13, 0r 14.

Note: you need the administration privileges to mac machine.

Uninstall Java from mac os with commands [Fixed]

Thursday, November 18, 2021

Eclipse System.out.println Shortcut for windows and mac os versions

1. Overview

In this tutorial, we'll learn how to launch and shortcut for system.out.println in eclipse for java development.

Usage of System.out.println() is very useful to debug the program easily when you are doing the application development or learning phase.

But it is recommended to use Log4j or slf4j api for logging the relevant info in production environments.

All shortcuts showin in this article will work for windows and mac os x operating systems eclipse versions.
Eclipse System.out.println Shortcut for windows and mac os versions

Sunday, May 17, 2020

How to Find The Workspace Location in Eclipse (Mac OS or Windows)

1. Introduction


In this article, We'll learn how to see the current workspace location in eclipse. This is needed if you do not know how to find it. We will also try to find out the list of all workspaces used in your eclipse. This solution works for any operating system like windows and mac os x.

Monday, April 6, 2020

3 Ways to Fix Git Clone "Filename too long" Error in Windows [Fixed]

1. Introduction


In this tutorial, We'll learn how to fix the git clone error "Filename too long" in windows operating systems Powershell and GitHub Application. This happens when doing a git clone from remote repositories.

Most used Git Commands

This error does not come for the UNIX or mac users. So they can push the long length file names to git but the issues occur only for the windows users. Because this capability is disabled by default in the Windows operating system.

Usually, Git has a limit of 4096 characters for a filename, except on Windows when Git is compiled with MSYS. It uses an older version of the Windows API and there's a limit of 260 characters for a filename.


3 Ways to Fix git "Filename too long" Error in Windows [Fixed]

Monday, March 23, 2020

How to Fix java.lang.UnsupportedClassVersionError

1. Introduction


In this article, We're going to learn how to fix the common runtime error java.lang.UnsupportedClassVersionError

From API: Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.

How to Fix java.lang.UnsupportedClassVersionError?The simple cause is saying code is compiled at a higher version and running with lower java version. The solution is either run the code with the latest java version or compile the code with older JDK.

But let us see in detail what is the exact cause and how to fix it in various tools such as in command line, Eclipse and IntelliJ Idea tools.


[Fixed] Java was started but returned exit code=13 - Can't start Eclipse

Java was started but returned exit code=13 

1. Overview

In this tutorial, we''ll learn about the error while starting eclipse "Java was started but returned exit code=13" that can not start Eclipse and it's solutions.

Another similar error "java started but returned exit code 1" and same error can be seen with oxygen or neon "java started but returned exit code 13 eclipse neon" These are the common errors that we see frequently in our development process. Please see the following errors while starting up the eclipse after double click eclipse.exe file in eclipse location. 

Read more on "Troubleshooting" article.



[Fixed] Java was started but returned exit code=13 - Can't start Eclipse


We might be experiencing these errors after updating the java version or running OS or JAVA irrelevant eclipse versions.

1.1 Eclipse Error 

Java was started but returned exit code=13

We need to know about the following to solve these eclipse start up errors. All these are discussed in the further of this post.

1) Java version installed with os bit
2) Eclipse bit version
3) What is the problem coming while starting eclipse.

2. How to check java version installed

To check the java version that you are currently using, Open command prompt (cmd) using "windows + r" then then type "cmd" then command prompt appears in a new window as following.


java -version 

output:


D:\blogger>java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode)



[Fixed] Java was started but returned exit code=13 - java version



3. OS and Eclipse Bit Verification


We must know on which bit os is running on windows whether it is 32 bit or 64 bit and the same for eclipse whether 32 bit or 64 bit eclipse.

3.1 To know which Java bit is installed on Windows 64 bit OS

First way to check, Just see that where your java is installed in your C drive. Following are folder names. Check which directory your java installed.

Program Files (x86): This is the folder where
64-bit Windows places 32-bit programs.

Program Files: This is the folder where 64-bit Windows places
64-bit programs.

So, If your java is in  folder "Program Files (x86)" then java is 32 bit or If your java is in "Program Files" then it is java is 64 bit.

3.2 Finding the eclipse version of bitness (32 bit or 64 bit)


Second way to check the eclipse version in the location D:/eclipse/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807.

If you see the file name like this having "win32.x86_64" then downloaded eclipse is 64 bit or file name has "win32.x86_1.1" then eclipse is 32 bit.

3.3 eclipse.ini


Last way is Open the file eclipse.ini at eclipse root location.



plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.500.v20170531-1133 --> 32 bit.

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20120913-144807 --> 64 bit



4. Possible errors

If there is any compatibility issues between java and eclipse then the following errors are supposed to be happen.

Java was started but returned exit code=13 - Can't start Eclipse is commonly faced by most of the developers.

4.1 Error 1


!SESSION 2017-08-06 18:47:46.019 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.8.0_131
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_IN
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

!ENTRY org.eclipse.osgi 4 0 2017-08-06 18:47:53.020
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:260)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
    at org.eclipse.swt.internal.C.(C.java:21)
    at org.eclipse.swt.widgets.Display.(Display.java:138)
    at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:653)
    at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
    at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:154)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:96)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

4.2 Error 2


java was started but returned exit code=13
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
-os win32
-ws win32
-arch x86_64
-showsplash C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins\org.eclipse.platform_4.2.0.v201206081400\splash.bmp
-launcher C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\eclipse.exe
-name Eclipse
--launcher.library C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v201205221813\eclipse_1503.dll
-startup C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
--launcher.overrideVmargs
-exitdata 1e30_5c
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar


5. Fix to Java was started but returned exit code=13 


How to fix the errors:

The following solutions work for both errors.

5.1 Solution 1

Working combinations of OS, JDK and eclipse bitness (32 bit or 64 bit). In your case, if you were using 64-bit JDK with 32-bit eclipse in a 64-bit OS, after downgrading JDK to 32-bit then eclipse will start working.

It's good to use one of the following combinations.

32-bit OS , 32-bit JDK , 32-bit Eclipse (32-bit only)
64-bit OS , 32-bit JDK , 32-bit Eclipse
64-bit OS , 64-bit JDK , 64bit Eclipse (64-bit only)

This solution should work but it is tricky. You should know the versions as described above.


5.2 Solution 2

If java is configured wrongly in Eclipse.ini file in the eclipse directory.

Eclipse.ini file must have a valid absolute java location. If you have installed many java version, select right version that compatible to the current eclipse.

-vm 
C:\Program Files (x86)\Java\jdk1.8.0_201\bin\javaw.exe



If OS is 32 bit then java and eclipse version also should be 32 bit.  Please make sure, you are having all 32 bit version.

If OS is 64 bit then there might be a chance of having two java versions 32 bit and 64 bit.

Check your eclipse version then open file "eclipse.ini" in eclipse root folder and add the following to it.


For 32 bit eclipse --> add "-vm C:\Program Files (x86)\Java\jre1.8.0_131\bin\javaw.exe"
For 64 bit eclipse --> add "-vm C:\Program Files\Java\jre1.8.0_131\bin\javaw.exe"

From eclipse.ini file:

After adding -vm arguement.

--launcher.appendVmargs
-vm 
C:\Program Files (x86)\Java\jdk1.8.0_201\bin\javaw.exe
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC



-vm -javaw.exe Java was started but returned exit code=13

Note: Check the location on your machine where the java installed.

5.3 Solution 3

By default, eclipse refers to the java version which is present in "PATH" variable. If you have non compatible java path is added to "PATH" then above two solutions may not work.

Please add the correct java version location or remove from "PATH".

Note: Once you are able to launch Eclipse, make sure you verify the installed JRE location under Java --> Installed JREs in the Preferences window.

Download the latest eclipse version from the official link here. (Luna, Mars, Neon, Oxygen)


New eclipse package includes

    Data Tools Platform
    Git integration for Eclipse
    Eclipse Java Development Tools
    Eclipse Java EE Developer Tools
    JavaScript Development Tools
    Maven Integration for Eclipse
    Mylyn Task List
    Eclipse Plug-in Development Environment
    Remote System Explorer
    Code Recommenders Tools for Java Developers
    Eclipse XML Editors and Tools

6. Conclusion


In this tutorial, We've seen what are the common issues that occur when we start eclipse. Most common issues are

1. java was started but returned exit code=13
2. Cannot load 64-bit SWT libraries on 32-bit JVM


Discussed what are the things needs to be checked on the initial steps and provided all possible solutions. This tutorial will provide the accurate solutions for eclipse issues.

If these are not helping, Please post your exact error what your getting in your case. We will provide you the fix.

References:

TheCrazyProgram Fix
JavaHungry Answers
StackOverFlow

Friday, November 22, 2019

Python - TypeError: Object of type 'int64' is not JSON serializable (Works for all data types - Integer, Float, Array, etc)

1. Overview


In this tutorial, You will be learning how to solve the problem in python "TypeError: Object of type 'int64' is not JSON serializable" and "TypeError: (Integer) is not JSON serializable". These two errors come into existence when we working with JSON Serialization. Solutions shown in this article will work for apart from the int or int64 type such as float, array and etc.

Below is the scenario where my friend faced the problem.

Python TypeError Object of type  int64 is not JSON serializable

Wednesday, July 3, 2019

[Fixed] Error: Could not find or load main class

1. Overview


In this tutorial, We'll learn What does "Could not find or load main class" mean?

A common problem that new Java developers experience is that their programs fail to run with the error message: Could not find or load main class.

What does this mean, what causes it, and how should you fix it?

The problem is with this java run command

java  command syntax

We have gathered all these solutions from StackOverflow page and arranged in a simple manner to understand easily.

[Fixed] Error: Could not find or load main class


Please read section 2 and 5 to get a clear understanding. Section 3 tells about all areas where we do mistake usually. But, recommend reading the complete article.