Java program not displaying on high DPI screens - java

I am very new to Java programing but am managing a deprecated Java software as a part of my job. The old program renders perfectly on lower resolution screens but as the company moves to a higher DPI line of devices (primarily Microsoft Surfaces), the program is very small. I found many ways online to adjust the resolution of other programs through the use of Manifest files but can't seem to get anything to work. I also saw that the swing.properties file can be changed to fix it, but the program doesn't use swing. Are there any external files that can be used to change the resolution for this program?
The issue arises on Windows 10 high DPI devices and the program comes with it's own version of Java installed in the users AppData folder and thus does NOT use the Java installed regularly on the device.

I had the same problem and tried several different solutions with limited success. The only one which worked for me was to adjust the properties of the java.exe and/or the javaw.exe executables as described in this superuser answer:
https://superuser.com/a/1207925
This worked perfectly for me.

Related

Visual Studio Code - lagging when typing

I have just installed Visual Studio Code together with the Java Extension Pack. However, when I opened my first file and started typing, the text I type appears after a delay - reaching up even one second.
I have a hunch that it might be due to the number of processes going behind the editor, like real-time syntax checking, autocompletion, code hints et cetera. Perhaps the laptop I am working at simply cannot handle that much. These are the parameters of my current machine:
Processor: Intel(R) Caleron(R) CPU N3350 (1.10 GHz)
RAM: 4 GB
I have another hunch that it may be due to the processor.
So, are there a ways to switch off these facilities like real-time error-checking? If not, what other IDEs for Java could you reccomend? (Apart from Eclipse)
Had the same problem using Visual Studio Code while using Android Studio along with an Android Simulator in the background, and I run 8GB RAM and a CPU of 3.2GHz but when I returned to Notepad++ (I know its suicidal), to check if it is my problem or because of the IDEs, I typed in real time.
It is due to your processor as Visual Studio Code is not really recommended for "slow" CPUs. Personally I like it, although an IDE in the likes of Vim might suit you better.
Here is a link that might give some more hints:
https://github.com/Microsoft/vscode/issues/38409
The easiest solution I found was to download and install Visual Studio Code Insiders. It's nearly identical except that it's known to lag less. Installing this will also clear any extensions or preferences you have enabled which might be causing the lag:
https://code.visualstudio.com/insiders/
You may also need to run it from the command line with the --disable-gpu flag
code-insiders --disable-gpu
or
/Applications/Visual\ Studio\ Code\ -\ Insiders.app/Contents/MacOS/Electron --disable-gpu
depending on your OS
Try the following steps:
Disable any unnecessary extensions.
Update to the stable version.
If this still hasn't worked, try reinstalling your Visual Studio Code instance.
Same for me, I often let the computer sleep instead of turn off and kill all processes so it was normal for me that the VS was open for a few days, the solution was to close visual studio and reopen it.
maybe its the computer performance issue. i am using a laptop.
yesterday i uninstall large program (MS SQl server)
now typing speed back to normal.
I've now had this problem a number of times. As a matter of fact I just had it right now.
What solves it for me is to
Close VS code
Unpin it from my taskbar
Pin it back
It works well after that.
Closing and reopening VS Code has never worked for me
Please disable Spring Boot Tools from Pivotal!!!
This extension doesn't work well with other Java extesions.(ie. Extesion pack for Java and Language support for Java)
After disabling it, I've seen significant speed increase with Intellisense, and CPU load reduced as a result. Please get rid of the thing!!!

Java-utilizing programs malfunctioning

Ok so I've had this problem for as long as I've had this computer.
Almost all programs which utilize java in some way seem to be malfunctioning, e.g Geogebra, Maple, MarvinSketch etc.
The problem is hard to describe but it's some kind of image distortion that changes when the cursor is moved around.
Funny enough Java IDE software such as Eclipse and JCreator work just fine, the programs on them as well.
Here are some pictures:
https://drive.google.com/file/d/0B8FJefOEBlXEWm4yR0I5bHBVX0U/view?usp=sharing
https://drive.google.com/file/d/0B8FJefOEBlXEZEpRYmhleW1KdFE/view?usp=sharing
Things I have tried:Reinstall Java (duh),cleared Java cache, tried every possible compatibility settings, reinstalled the malfunctioning programs
I am currently running the latest version of java (both 32 and 64 bit) on Windows 10.
I would be really thankful if anyone could help me on this one, as Google couldn't.
P.S: There are no issues with the hardware performance and all drivers are up to date.

Java IDE for working over Remote Desktop

I have recently found out that anything Swing(NetBeans, IDEA) is excruciatingly slow to paint the UI over Remote Desktop(RDP).
Can you guys give me any suggestion for something that will work properly over RDP?
Actually, contrary to everything I've seen - mostly the "Dsun.java2d.noddraw=true", which is mentioned in a number of places, it is actually setting it to false that fixed the drawing issues(for me at least). Go figure.
RDP is optimized for native Windows apps and, regrettably, newer versions of RCP (like Vista/Win7's default RDP) is even more hostile to non-native apps than older (XP/Server 2003) versions. Here's a good link:
http://devnet.jetbrains.net/thread/280673
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4204845
One workaround is to get a screaming fast CPU/graphics board, tons and tons of memory and a super high-speed network connection :)
Another is to:
Select "32-bit true color" in your Terminal Services settings
Select "Modem"
Reduce screen resolution (heck, use 1024x768 if possible)
Here are some additional tips:
http://www.codinghorror.com/blog/2006/04/remote-desktop-tips-and-tricks.html
Try setting "Dsun.java2d.noddraw=true"
http://ubuntuforums.org/archive/index.php/t-1129187.html
http://www.mindfiresolutions.com/Solving-DIRECT-DRAW-ddraw-problems-in-Java-Swing-730.php
I am launching a java swing application from Linux, and display it as a Windows frame thanks to MobaXterm.
If you haven't done it already, please have a look at the following documentation :
https://docs.oracle.com/javase/8/docs/technotes/guides/2d/flags.html
Using -Dsun.java2d.noddraw=true did not fixed my issue, but setting xrender to true did.
So here's the code I used on Linux :
export _JAVA_OPTIONS='-Dsun.java2d.xrender=true'
java -jar my_java_application.jar
Maybe it's not only Swing that paints slow over Remote Desktop. However, Eclipse is based on SWT, based on native widgets, so it is not Swing.
You should give JavaWIDE a try. It is an IDE designed for access to a JDK without it installed on a system, with a built-in storage system so you just need access to the internet. It's not exactly a program for accessing everything on the computer but it will do a good job with your programming. It may take a while however, as the compiling is done on a separate server.

Tricking Java Web Start About the Operating System

I'm restoring an antique vehicle and for that I use the EPC (Electronic Parts Catalog) from Mercedes Benz. (Membership is free, so those wanting to see the program I'm talking about can go here if they want to check it out.) To get to the program, there's a sign in page, then another page with a link. Clicking the link downloads a file called ewa-net.jnlp and it's launched with JavaWS.
I used to use this program on my Linux system and it worked. I remember I changed either the osname variable in my /etc directory or I changed the OS in Firefox before I ran the program and changed it back when I was done, so it wouldn't effect any other Java program. The EPC program worked just fine under those conditions. I strongly suspect the reason for requiring Windows is more of a defensive move (for example, to avoid liability or to avoid having to fix bugs on multiple OSes).
I'm aware that making changes like this can mess up a program, but this is used only to go through the parts catalog and to examine part diagrams, which helps in determining part locations or placements or helps the parts guys because I can help them find the page a part is on quickly if I've done my research before calling them. I'm not saving data or modifying anything on a disk drive or elsewhere (although I do sometimes take a screenshot and print it out).
I cannot download ewa-net.jnlp and just run it whenever I want. I have to go through the HTML login page, then run the program from their site, so I can't just run the program from the command line or something like that. (Unless that replaces running it with JavaWS right after I log in.)
Now I'm using an iMac, using Snow Leopard. I tried finding and changing the osname on here, and it didn't work.
Right now whenever I need to use the EPC, I have to start up a Windows VM in Parallels and about the only reason I use that Windows VM is for this program.
Is there some way I can trick Java so when I run this program, it thinks it's on Windows? I'm aware this could crash, but since the catalog worked fine on Linux, I want to at least try it on OS X.
I thought maybe I could use a wrapper script that runs JavaWS, but I'm not quite sure what to do and, as I said previously, changing the osname setting didn't seem to work.
Is there anything that might help me trick this program into thinking it's on Windows?
It depends on exactly what is applying the Windows restriction.
It is possible for a JNLP file to specify elements for specific operating systems only, thus effectively restricting it to a particular OS. So if the JNLP file contains something like this...
<resources os="Windows XP">
<j2se version="1.5+" />
<jar href="/example.jar" />
</resources>
...then that could be what's preventing you from running it on Mac OS X. Have a look at the JNLP file (I'm unable to see it, as a non-US resident I can't sign up myself) and see if that's the cause. If it is maybe you can edit it. Why is it that you said you can't download ewa-net.jnlp? If you can download the JNLP file, edit it to have os="Mac OS X", then double-click it to run it (or right-click and choose Open With > Java Web Start).
Alternately, the reason why changing osname didn't work for you could be that you changed it in the wrong installation of Java. Apple moved the installation location of Java sometime (I think) after Snow Leopard was released. So you may find your installation in either of these locations:
/System/Library/Frameworks/JavaVM.framework/Versions
/System/Library/Java/JavaVirtualMachines
If you only updated one of these locations, you may have to do it in the other location too.

VLC dying when called from inside Java

I'm having a problem that, at this moment, I don't even know how to investigate properly. Any recommendations on how I can get more information are welcome and appreciated.
My company sells a product with a WinXP PC at its core. One of the product's tasks is being able to start a video player on demand -- VLC, in this case. (To be specific, VLC 0.8.6d; it's several years out of date, but upgrading is problematic for a few reasons.) The application responsible for starting the player and performing many, many other tasks is written in Java.
I have a test rig sitting next to my desk. It used to work just fine. But for some reason, it now gives a "Send Error Report" window when the Java app tries to start VLC: "VLC media player has encountered a problem and needs to close...." You know the one.
Clearly, I've done something that buggered things up. Problem is, I know neither what it could be nor how I would go about fixing it.
Stuff I know:
It's not a code bug. I run the same software on my development desktop machine, and it doesn't have this issue.
It's not the VLC install, nor is it a malformed video file. When I capture the command used to start it from Java and manually enter that command from a "cmd" window, it works fine.
It's not that sneaky bastich bug where Java punishes you if you don't manually drain STDERR and STDOUT when making a system call. I've got that covered.
I'm not getting any error messages or output when it fails; it just fails and gives me that pop-up window.
I'm stumped. Recommendations for either what it could be or how I can figure out what it is are very welcome.
Well, I’m not familiar with java and VLC, but I would do the following things:
Check that you have identical java virtual machines in both of your desktops. Just in case…
Check the process’s environment variables. They depend on parent process. Maybe VLC uses some of them.
Try to debug crashing with native debugger like WinDbg. Perhaps the call stack will give you more ideas.
Good luck!
My suggestions:
Create a simple java app that just launches VLC
Use your app to launch a simple command line windows program
Use your app to launch a complex program
Check to see if there is a memory constraint issue. Is VLC getting too little memory to run?
This really sounds like a memory/environment issue.
A number of things I would try
Make Sure both test and development machines are identical in every respect, the operating syste(if possible installed from same OS Disk), same JVM version, same memory allocation to JVM (you know those -X-ms stuffs). My fear is not with Java/JVM per se, it is with windows.
Make sure you can lunch for example Notepad from a Java app, and then something like Windows Media Player or MS Word.
Try and launch other versions of VLC to see if it is a VLC version problem.
Finally try and wipe the test box and re-install it(with Windows, you can never tell, a fresh installation might just do it!!)

Categories