How to fix font rendering in PHPStorm 10 in Linux? - java

Default font rendering always was rather ugly in Java apps in Linux. But there was good solution - OpenJDK font fix (openjdk-fontfix PPA in launchpad).
It worked great in PhPStorm 9 and previous versions, but it has stopped working in 10 version. Java options in config are identical.
Is there any way to fix font rendering?
Rendering before:
Rendering after:

Solution to fix this problem is simple: just rename jre folder in PHPStorm installation directory. Since 10 version app is bundled with its own JRE, so it doesn`t use system JRE by default.

Remove the bundled JRE
Add to
bin/phpstorm64.vmoptions
this two lines:
-Dswing.aatext=true
-Dawt.useSystemAAFontSettings=on
And in
Settings->Appearance & Behavior -> Apperance
Antialiasing:
IDE:Greyscale, Editor:Greyscale

At least on Arch Linux, when using OpenJDK, font rendering looks perfectly smooth. To force PHPStorm to use the system's OpenJDK instead of the bundled Oracle JDK, you have to set the environment variable WEBIDE_JDK to your OpenJDK path.
To do this in an update-safe manner, copy the .desktop file to your home dir:
$ cp /usr/share/applications/jetbrains-phpstorm.desktop ~/.local/share/applications/
And then change the content to:
[Desktop Entry]
Version=1.0
Type=Application
Name=PhpStorm
Icon=/opt/phpstorm/bin/webide.png
Exec=env WEBIDE_JDK=/usr/lib/jvm/java-8-openjdk "/opt/phpstorm/bin/phpstorm.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-phpstorm

Some times all of this doesn't work, if you use some distros.
In ubuntu's don't work font in sql panels and some popup's in editor.
In fedora's after install pathed jdk you can't see all fonts in editors.
For get good font rendering you should use patched jdf and distros with Infinality ( ROSA, Arch, RFRemix and etc.) or install it in your system.
Download patched jdk from https://code.google.com/p/tuxjdk/ and extract archive
Install it in your system and add new java in you enviropment:
sudo mv ~/Download/jdk-8u25-tuxjdk-b01/ /opt/jdk-8u25-tuxjdk-b01/
cd /opt/jdk-8u25-tuxjdk-b01/
#update-alternatives - for deb system's, for rpm use alternatives
sudo update-alternatives --install /usr/bin/java java /opt/jdk-8u25-tuxjdk-b01/bin/java 2
sudo update-alternatives --config java
export JAVA_HOME=/opt/jdk-8u25-tuxjdk-b01
export JRE_HOME=/opt/jdk-8u25-tuxjdk-b01
export PATH=$PATH:/opt/jdk-8u25-tuxjdk-b01/bin:/opt/jdk-8u25-tuxjdk-b01/jre/bin
Install Infinality. Some article don't do it and get good font rendering. But if you start coding in JetBrains products you can see that in some editor in popup's and some special panel haven't any antialiasing and looks so awful.
sudo add-apt-repository ppa:no1wantdthisname/ppa
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fontconfig-infinality
After all you should setup infinality rendering style. Best render i get with ubuntu style. This option you can't get with setstyle command, that's why you should edit settings file. And in this file, search for USE_STYLE (it should be USE_STYLE="DEFAULT" by default) and change it to "UBUNTU".
sudo -H gedit /etc/profile.d/infinality-settings.sh
After installing you should log out. If after all you see not good antyalyzing - configurete infinity for you system.
This solution tested on Ubuntu, Xubuntu, Kubuntu, Linux Mint KDE, Fedora 21-23, RFRemix 20-23 ( have infinality in default), ROSA Fresh KDE ( have infinality in default need only patched jdk). If it's don't work for you check folders path for java and setting infinality for you system.
Result:

I used Netbeans then phpstorm on linux mint.
Bad fonts appear in editor when using Oracle JDK , I removed Oracle JDK and netbeans fonts and menu problem mouse over fixed.
Recently I got phpstorm as prequests install Oracle JDK every thing work fine except fonts, I made deep search and test many soultion.
finally I just install OpenJDK latested one by:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
for more about intalling openJDK
and in phpstorm there is option to select java on booting up :
check link to see:
https://www.jetbrains.com/help/phpstorm/switching-boot-jdk.html
just choose OpenJDK from list and restart phpstorm every thing will be work fine.

Related

How to uninstall Java 9 on macOS Sierra

I'm having trouble removing Java 9 from my macOS Sierra system.
I accidentally installed Java 9, instead of Java 8, so now all my Eclipse projects give me these warnings: Build path specifies execution environment JavaSE-1.8. There are no JREs installed in the workspace that are strictly compatible with this environment.
I have used the following guide, but it did not work. Here is my command output when running java -version from the command line:
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
for macOS high sierra removing java 9:
delete the java folder you find in the dir shown to you after executing:
/usr/libexec/java_home -V
use "Go to" in finder and copy and paste the dir to get there
There are two commands which are very simple and useful. If you want to keep multiple versions simply set JAVA_HOME to version you want to use.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_(version you want to use).jdk/Contents/Home
Example--> export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Else in addition to above command remove/uninstall additional jdk version from your system with below command.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-(version you want to remove).jdk/
Example --> sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/
Please refer below github link for additional details -->
https://gist.github.com/schnell18/bcb9833f725be22f6acd01f94b486392
Thanks
On MacOS you can list what JDKs you have installed and where they are installed to with:
/usr/libexec/java_home -V
If you want to select one of the installed JDKs to be used as default, you can do:
/usr/libexec/java_home -v 1.8
Verify which is now default with java -version.
You can manually add the location of other installed JREs in Eclipse via Preferences / Java / Installed JREs , press Add, and then point it to one of the locations should with the -V option above. You can then check it to select which is default for your projects.
After viewing which Java Virtual Machines I had on my computer using the following command:
ls /Library/Java/JavaVirtualMachines
I realized no additional JDK's would appear after using the Java 8 installer (besides Java 9). When doing further research, it turns out I had installed the other version that is not a SE development kit and it was just working in web browsers, not for the terminal.
For anyone having the same issue, make sure you use the Java SE Development Kit 8.
Uninstall Oracle Java using the Terminal:
Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo tool.
Remove one directory and one file (a symlink), as follows:
Click on the Finder icon located in your dock
Click on the Utilities folder
Double-click on the Terminal icon
In the Terminal window Copy and Paste the commands below:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.
Source:https://www.java.com/en/
I believe the problem is navigating to the correct directory... Once you are where you are supposed to be you can run the sudo commands to remove whichever versions of java you want to remove.
First, run the command in the terminal to determine which version of Java you are running,
java -version
then you can navigate to pesky version of java that you intend to delete by using the following command:
cd /Library/Java/JavaVirtualMachines
then once you see are in the JavaVirtualMachines path, type in ls to see what versions of Java you have installed,
ls
and finally when you know which version or versions of Java you want to uninstall:
sudo rm -rf jdk-10.0.1.jdk #or whichever version you want to delete
I know that you've asked about how to uninstall the java version. But, I think it's important how to manage your Java version in a very good way.
For me, the best way is using SDKMan, a very nice tool for managing you Development tools like Java.
Here you can learn more about it: http://sdkman.io/
You can install your Java version as follow:
$ sdk install java
You can install others tools like Scala:
$ sdk install scala 2.12.1
Uninstall your tools very easy:
$ sdk uninstall java 9
And so on. Hope this helps you in future installation of your development tools.

Error While installing netbeans in ubuntu 12.04

I tried to install netbeans 'netbeans-7.2.1-ml-linux.sh' on my ubuntu12.04
But when i am executing this .sh file i am gettig the exception given below.
Configuring the installer...
Searching for JVM on the system...
Extracting installation data...
Running the installer wizard...
Can`t initialize UI
Running in headless mode
Exception: java.awt.HeadlessException thrown from the UncaughtExceptionHandler in thread "main"
You need to install Java Runtime Environment
sudo aptitude install default-jre
Refer to this answer:
netbeans installation error: can't initialize ui running in headless mode
Worked for me. For some reason, with OpenJDK the installer was unable to open a GUI.
The Problem is the support of openJDK for the UI.
The solution is installing Oracle JDK, open your terminal and write the following commands:
sudo apt-get remove openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
after that reinstall netbeans.
You're missing a X-Server for installation (java.awt.HeadlessException). The installation script needs a UI.
For some reason the sh installer does not work with the openJDK 7.
Quick fix to install is to change back to JDK 6.
run:
sudo update-alternatives --config java
(select java 6)
sh netbeans-7.2.1-ml-linux.sh
the installer should run and then just switch back to the java 7 JDK with update-alternatives.
In my case, I had openjdk installed, where /usr/bin/java was point to the installed openjdk.
I solved it by installing the Oracle JDK 7, from a tar.gz file. Extract the tar ball to a location say your $HOME directory.
After that
I modified the .bashrc file and modified the PATH variable to
PATH=$HOME/jdk1.7/bin/:$PATH export PATH
Remember the path to your jdk/bin should be appended to PATH, as as result the system will find the java executable in your path rather than picking the installed openjdk.
Note: I chose not to uninstall installed openjdk, as most of my Libreoffice and other installed applications were depending on it.
First you have to update
sudo apt-get update
Then default java
sudo apt-get install -f default-jre
sudo apt-get install -f default-jdk
And should be done.
This is what fixed it for me:
I installed the Java JDK. In this case:
sudo aptitude install openjdk-8-jdk
Here's the kicker: I made sure that my Home and Path variables were set properly. Again, in my case:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
export PATH=$PATH:/usr/lib/jvm/java-8-openjdk/bin
My initial issue was not having the JDK installed. It was then not having the environment variables properly set. If they aren't properly set, the installer won't launch. Simple as that.

Font 'Arial' is not available to the JVM

I'm working on a Java project that uses Jasperreports. I worked several times in other projects using the same technology, and i had the same problem when trying to print a report in Unix environments.
My project uses:
JBoss 4.2.3.GA
Java 1.6
Jasperreports 4.7.0
The exception thrown is:
net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Arial' is not available to the JVM. See the Javadoc for more details.
I found a common solution to solve this issue and ir really works:
sudo apt-get install msttcorefonts
However, I want to understand how Jasper works with fonts, and how it searches this fonts installed in Unix environments. Maybe a better question is: how JVM handles native fonts? Can anyone give me a detailed explanation on this subject? How are system fonts made available for the JVM in runtime?
Java asks the OS to provide the fonts. How that works depends on the OS.
http://en.wikipedia.org/wiki/Arial states its is installed on MS-Windows and MAC OSX
If you don't want to go through the hassle of downloading jars and what not, just go to software-center and click install Ubuntu restricted extras. This package will install not only MS Fonts but other supports for applications with restricted copyright.
This works for Ubuntu Systems.
I was also facing the same issue on Jasper 5.0. I have followed the steps below:
Place the jasper-fonts.jar;
Install the missing fonts in the linux;
Restart the JBoss server.
Update for year 2015:
Add this to (or uncomment in) /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
Then run this:
sudo apt-get update
sudo apt-get install msttcorefonts
for OpenSuse
validate the fonts is no aviable on SO
fc-list | grep "Arial"
install the followin rpm
sudo rpm -ivh msttcore-fonts-2.0-3.noarch.rpm
or Download from page:
http://www.mjmwired.net/resources/mjm-fedora-f11.html#ttf
Install the rpm
validate again
fc-list | grep "Arial"
Restart your aplication server
this save my day !
http://jasperstarter.cenote.de/usage.html#Reports_with_custom_fonts
Reports with custom fonts
Jaspersoft Studio has an option to create a jar file of your fonts. Just put this jar file into the jdbc folder of JasperStarter.

Ant needs tools.jar and unable to find it

I am putting together a dev environment for a Java program and after the first try of my Ant build scripts I got this error:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
While the path to the jdk is correct, the tools.jar really wasn't there. Is it actually supposed to be there or did I get some config/installation thing wrong?
It seems like you can have Java installed in /usr/lib/jvm/java-6-openjdk but only have the JRE, not the JDK. This fixed it for me:
sudo apt-get install openjdk-6-jdk
Note: On CentOS / RHEL installing java-1.x.0-openjdk will not be enough. Also install java-1.x.0-openjdk-devel.
It's there on my machine. I'm running Sun JDK 1.6.0_21 on Windows XP SP3.
Are you sure you have the JDK? Is it possible that you only have the JRE?
On Debian, after installing Ant with apt-get install ant, I've encountered the same error when running it:
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk-amd64/lib/tools.jar
Indeed, there's no mention of any tools.jar anywhere in /usr/lib, although /usr/lib/jvm/java-6-openjdk-amd64 itself does exist.
https://packages.debian.org/search?searchon=contents&keywords=java-6-openjdk-amd64%2Flib%2Ftools.jar
As per the search above, java-6-openjdk-amd64/lib/tools.jar appears to be part of openjdk-6-jdk, which indeed didn't get installed with ant (since it's only marked as suggested (https://packages.debian.org/wheezy/ant)).
apt-get install openjdk-6-jdk
apt install defalut-jdk # this doesn't contain some file, like tools.jar...
apt install openjdk-8-jdk # this contains all files.
On Ubuntu I've just need to install JDK
sudo apt-get install openjdk-7-jdk
..and you can always search for all available versions with
$ sudo apt-cache search openjdk | grep ^openjdk
From the website https://openjdk.java.net/install/ we can read
The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package.
Try the following:
% sudo apt-get install sun-java6-jdk
% sudo update-alternatives --config java
select the option that has the path
/usr/lib/jvm/java-6-sun/jre/bin/java
Worked for me on an ubuntu 10.4
u can try to put your JAVA_HOME also, as follows:
% sudo export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
Installing the jdk-6u45-linux-x64.bin (from the oracle.com site) via unzip does not result in a tools.jar. I guess that file is created by the "make-jpkg" script. Once I did that, and installed the resulting .deb file, everything was fine.
I really hate oracle's lawyers.
Even if you have jdk installed, you'll need to redirect JAVA_HOME to point to it.
Here's one weird trick you can put into your .profile to set JAVA HOME properly, no matter which java you have:
export JAVA_HOME=$(dirname $(dirname $(readlink -e /usr/bin/java)))
# Test for jdk installed above jre
if [ -x $JAVA_HOME/../bin/java ]; then export JAVA_HOME=$(dirname $JAVA_HOME); fi
On Ubuntu I've fixed this problem by installing package
openjdk-7-jre-lib
tools.jar appeared after that.
(I know this is an old post, but comment in hope that it will be helpful for somebody lurking for answer like I was today.)

Java on Debian: Probable fatal error: No fonts found

I want to run Tomcat on Debian 5 Minimal. So I don't need a gui for my OS, it's just a pure Tomcat-Server.
Which packages do I need for my JVM to use Fonts in my applications? Im drawing texts in Graphics2D and am creating PDF-Files in my Java-Project.
I had similar problem on CentOS, after crunching for a solution..
I solved this problem by installing fonts like follows:
sudo yum install bitmap*
sudo yum install dejavu-lgc*
sudo yum install bitstream-vera*
Graphics2D and anything in the java.awt.* or java.swing.* packages require a GUI to do its drawing.
This is a problem on most headless servers. You have two options, and try them in this order:
Use the system property "java.awt.headless" and set that to "true"
java -Djava.awt.headless=true or System.setProperty("java.awt.headless", "true");
Install the XWindows Virtual Frame Buffer (xvfb) on your server. This keeps the server headless, but provides the XWindows primitives needed to draw on a virtual screen. It is far from optimized (no graphics acceleration), but it will allow your system to work again.
The java.awt.headless option was introduced with Java 1.4. See: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/
In the event that does not work, install the XVFB package and configure it to create a virtual frame buffer large enough to do your drawing.
I fixed this by installing some fonts (under Ubuntu) by:
apt-get install msttcorefonts
They should be installed in /usr/share/fonts/truetype/.
Dont forget to restart Tomcat if you use it.
None of the answers above worked for me on a Amazon Linux AMI with OpenJDK 1.6.0_20. However this worked:
sudo yum install dejavu*
ln -s /usr/share/fonts/dejavu /usr/share/fonts/dejavu-lgc
The first line installs some default fonts, and the second ensures that Java finds them. More at http://brandon.fuller.name/archives/2011/09/12/00.05.15/
I encountered this issue with Atlassian Bamboo recently. On Scientific Linux all that I was required to do was:
sudo yum install dejavu*
(Unlike mkvalsvik I did not need to make a symlink).
For me, this has solved it: https://bugzilla.redhat.com/show_bug.cgi?id=708201
Basically the 'java' package did not depend on 'fontconfig', which had to be manually installed.

Categories

Resources