Recently, I encountered an issue with my .bashrc file on my Ubuntu system that left my terminal unusable, eventually all stuffs like developing, running, testing halts. Here’s how I identified and resolved the problem.
I was trying to install WebLogic on my local system to check for compatibility issues. My Java version at the time was:
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)
When I attempted to execute the WebLogic installer JAR file with the command:
java -jar fmw-....jar
it fails.
Checking the error logs, I found the following message: the openjdk jvm is not supported on this platform.
The installer required Oracle Java, but I was using SDKMAN! to manage my Java versions. SDKMAN is similar to RVM for Ruby, but due to licensing restrictions, it no longer provides Oracle Java.
To work around this, I decided to switch to Zulu JDK but ultimately opted to manually install Oracle JDK 8 instead.
Steps I Took:
-
Downloaded Oracle JDK 8 and extracted it.
-
Placed it in /opt/java/jdk.
-
Set JAVA_HOME, ensuring it pointed to the new JDK instead of SDKMAN.
After setting the new path, I verified the Java version:
java version "1.8.0_431"
Java(TM) SE Runtime Environment (build 1.8.0_431-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.431-b10, mixed mode)
😆
💚 Now, Java was correctly set up.
Later, I navigated to the installer’s directory in a new terminal window and re-ran the command—only to face the same error. Checking the Java version revealed that my shell was still using OpenJDK instead of the newly installed Oracle JDK.
At this point, I realized that my PATH was not updated permanently. Since .bashrc
is responsible for configuring interactive non-login shells, I needed to reload it.
source ~/.bashrc
The command froze. Nothing happened. Even pressing Ctrl + C didn’t work.
- I opened a new terminal—same issue, it was stuck.
- I restarted my system multiple times—no improvement.
- The terminal simply hung, waiting indefinitely. 😨
Realizing that .bashrc
was likely causing the issue, I manually edited the file:
I undid all my recent changes—but the problem persisted. As a last resort, I deleted all content inside .bashrc
, and my terminal started working again. 🚀
Unfortunately, this also meant I lost all my Java, Ruby environment configurations. 😞. And all my projects starts throwing error.
I carefully restored my .bashrc
content line by line to identify which one was causing the issue. Eventually, I found the problematic line:
source <(ng completion script)
This stale Angular CLI autocomplete command was preventing the script from executing correctly, causing the terminal to hang.
I removed the problematic line, then ran:
source ~/.bashrc
Now, the terminal worked smoothly! 🎉
I re-ran the WebLogic installer, and this time, the installation window popped up successfully.
- Be cautious when modifying
.bashrc
A single incorrect command can render your terminal unusable. - If your terminal hangs after updating
.bashrc
try restoring an earlier version by editing or clearing the file. - Use
source ~/.bashrc
carefully. Ensure the file is free from syntax errors before sourcing it. - Check your PATH persistence. If Java (or any tool) isn’t behaving as expected, verify that the correct PATH is applied across all terminal sessions.
💡 Tip: Keep a backup of your .bashrc
file before making major changes:
cp ~/.bashrc ~/.bashrc.bak
This way, you can always restore a working version if things go wrong!