Specify a list of directories, JAR archives, and ZIP archives to search for class files. Class path entries are separated by semicolons (;). Specifying
For example, if directory foo contains a.jar and b.JAR, then the class path element foo/. is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list.
-classpath or -cp overrides any setting of the CLASSPATHLauncher Windows 10 Pc
environment variable.If -classpath and -cp are not used and CLASSPATH is not set, the user class path consists of the current directory (.
).
As a special convenience, a class path element containing a basename of *
is considered equivalent to specifying a list of all the files in the directory with the extension .jar
or .JAR
(a java program cannot tell the difference between the two invocations).
For example, if directory foo
contains a.jar
and b.JAR
, then the class path element foo/*
is expanded to a A.jar:b.JAR
, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of *
expands to a list of all the jar files in the current directory. The CLASSPATH
environment variable, where defined, will be similarly expanded. Any classpath wildcard expansion occurs before the Java virtual machine is started -- no Java program will ever see unexpanded wildcards except by querying the environment. For example; by invoking System.getenv('CLASSPATH').
For more information on class paths, see Setting the Class Path.
I'm trying to run a Java app (JAR file) on a high-DPI display on Windows 10. The app uses Swing and thus isn't DPI-aware. Normally when I run an application that isn't DPI-aware, Windows will scale it for me, albeit blurry. But for some reason it's not scaling the Java app; I just get a tiny little window in the corner with impossible-to-read text. How do I run a Java app with Windows' high-DPI (blurry) scaling?
Jeff EJar Launcher Windows 10 Free
Jeff E11 Answers
The problem here seems to be that Swing is by default claiming that it is DPI aware, so windows doesn't scale it. Use this switch to turn off this behavior and windows will start scaling your swing app:
[EDIT: Unfortunately, this flag no longer seems to work in Java 8, I was testing it in Java 6. Looks like this is a known issue.]
[EDIT 2: You can modify a Java 8 install to work correctly, using a program to modify the EXE manifests. I changed the setting from true to false in the manifests inside of java.exe and javaw.exe, and now my Swing programs scale correctly in Windows 10 high dpi. I used Resource Tuner to this.]
[Edit 3] Just use Java 9
Just found an easy solution on my Windows 10 machine:
- Find
java.exe
you installed. - Right click ->
Properties
- Go to
Compatibility
tab - Check
Override high DPI scaling behavior.
- Choose
System
forScaling performed by:
If you stumbled across this question but are actually looking for a solution that works on Linux, this is for you.
If you can add parameters to the java
binary which launches the application, you can use the option -D
to pass a value for the sun.java2d.uiScale
proprty to specify a scaling factor for Java2D. This will scale your application. The scaling factor value is a double. Make sure that you pass this option to the java
binary itself, not the launched Java application.
Example: Launch NearInfinity.jar with a UI scaling factor of 2.5
I found this article quite useful in general for running Linux on HiDPI systems, and some of the things might work on Windows as well: https://wiki.archlinux.org/index.php/HiDPI
Solution: Run it on JRE 9.
This is because the Java runtime declared itself to be 'DPI-aware' but didn't really supported it for AWT and Swing. Java applications were sized and rendered based on pixels rather than being properly scaled, this included HiDPI displays. Anyways, this has been recently solved. See the issue JEP 263: HiDPI Graphics on Windows and Linuxand the upgrade.
So, increasing the font size does not work (because it does not increase the rest of the things); the jvm argument -Dsun.java2d.dpiaware=false
does not work (because it is not really supported); and the manifest file + registry edit (for Windows) just does not work.
Then, You need to run it on JRE 9 because it really supports this feature.
To force all java executables to have 'properties > compatibility > dpi scaling mode' set to 'System', in an administrator powershell (win-x, a), run:
to undo:
Instead of HKCU you could use HKLM, but then you cannot change the dpi-scaling setting manually anymore in the properties > compatibility dialog of the java*.exe files.
You need to set PreferExternalManifest in regedit and create custom manifests for java.exe and javaw.exe as given in following stackoverflow answerhttps://stackoverflow.com/a/39372897
Thanks for Kenneth. I find C:Program Files (x86)Javajrebinjava.exe
then right click -> properties -> compatibility tab -> 'override high DPI scaling behavior'
and select System
, then it works.I also tried the same way to change the javaw.exe
's compatibility, it also works.
PS: I run burpsuite.jar
on win10 1703 using that method.
Jar Launcher Windows 10 2019
Elderry's solution is good, but what if you want to run a jar file on Windows and it doesn't have compatibility options?
Go to C:Program Files (x86)Javajrebin and find javaw.exe. Right click, properties, compatibility tab, check 'override high DPI scaling behavior' and select 'System' (Note that 'System enhanced' did not work for me).
Now jar file windows should scale properly with readable text. If not, it might mean that Windows doesn't link jar type files to javaw.eve like it should. A third party fix is available at: https://johann.loefflmann.net/en/software/jarfix/index.html
Try Java 10.
I found that -Dsun.java2d.dpiaware=false does not work in Java 9 or 10. Also for Java 8 and 9 my swing app is small, but Java 10 sizes properly in windows!
so for an app that you can run from a bat file like: java -jar xxx.jar
I just added JAVA_HOME=....java_10 and PATH=%JAVA_HOME%bin;%PATH% in the bat file.
java -jar xxx.jar
How To Run Jar Files Windows 10
I tried most of these solutions, but the one that worked for me was setting the system compatibility mode on the files I found in the following location:
I was able to get sensible dpi when ran using command prompt like:
Mokubai♦protected by RamhoundNov 30 '18 at 15:29
Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?