Launching new version of a Java application opens old version - java

I have got a new version of a Java Swing Application (DMG file) that I want to test, but it keeps opening the Old version of the application, even though I have deleted the old application. It's like it's opening a cached version.
This is how I install the application:
Open DMG file.
Drag file to Application folder.
I only see this issue on OS X. On Windows it works fine.
I even tried running the jar file directly, and I see the same behaviour; it works on Windows but on Mac it shows the old version.
I tried the following but I saw the same behaviour:
Restarting the computer
Clearing/Deleting the Java cache (from
System Preference>Java>General>Temporary Internet Files>Settings>Delete Files...)
Logging as the Guest user on my mac.
Lastly, I have tried this on a different Mac and I do NOT see the issue. It seems like there is something specifically wrong with my OS X.

There was a copy of the old version in /Users/*/Library/Java/Extensions which was required by the Robot test automation framework.
Deleting it solved the issue.

Related

Netbeans 8.2 not appearing in registry or allowing itself to be associated with files

I have installed Netbeans 8.2 and jdk and jre 1.8.0_171. (Windows 10 OS; on a clean installation of the OS btw, just to eliminate possibility of corrupted registry keys, viruses etc).
I believe I have correctly set the system environment etc.
I created a HelloWorld file in notepad; compiled on cmd line, then when tried to run the file, I was asked as to what (default) program I wanted to use to run it.
When I went to associate netBeans I was unable to do so because it does not appear either in the menu, or in the control panel file association facility.
Even more odd, is when I went to check the registry,
Computer\HKEY_CLASSES_ROOT\Applications
netbeans was not there.....
Netbeans itself btw runs and works absolutely fine, so I am rather baffled by this....
Please advise
If you are running a Java application from the command line in Windows then you should be using java.exe to run it. NetBeans is an IDE, and while it does provide functionality to allow Java to be run internally (i.e From within NetBeans), that is very different to using NetBeans directly to run a Java application.
Furthermore, NetBeans does not use the Windows Registry for application registration, which is why you cannot associate NetBeans with any file type. Just because NetBeans can be installed as a Windows application does not mean that it is required to implement all the possible functionality of a Windows Application, such as file association.
It's also worth noting that the beta release of NetBeans 9 is only provided as a zip file, and its installation consists of nothing more than unzipping the dowloaded file to a folder, so it definitely does not use the Windows Registry.

Tomcat 8.5 on Windows vs startup.bat issue

I have a very specific problem deploying a webapp on a Windows installation of Tomcat 8.5 ( version 8.5.29 ) that I have been pulling my hair out for the last few days with no success. My web application generates a PDF using JasperReports and within this PDF is a barcode ( which uses Barbecue 1.5-beta ). Running this report on my local install of Tomcat works great, but when I deployed it to the server it did not produce the barcode. I did not see any errors either
Barcode just has placeholder
I downloaded the 8.5 distro without all the Windows specific installers and files, fired up tomcat (startup.bat) and ran the report again. This time it worked. The barcode rendered and everything. Same exact web app directory and config files.
I copied every file from the generic distro to the windows Tomcat install directory and ran again. Same problem. I went into the Tomcat Config dialog, changed the start up mode from jvm to java, but no luck.
The java virtual machine setting is:
C:\Program Files\Java\jre1.8.0_161\bin\server\jvm.dll
I changed it to use default and still the same problem. The java options are out of the box settings ( same when I ran the startup.bat ).
My only guess is the tomcat.exe that is being run is doing something different, but I cannot even begin to figure out what the difference is. I removed the tomcat native dll (tcnative-1.dll 1.2.16 ), but again no luck.
I feel like I need to just run the generic Tomcat 8.5, but this needs to be running all the time and run as a service.
I can't believe one stupid barcode is causing me so much pain. Its for a warehouse packslip so it is required. At this point I am willing to drive to the warehouse and just manually draw the barcodes myself!
Perhaps someone out in the internet has experienced this and has an idea before I just end my career and become a juggler.

Desktop.isDesktopSupported() crashes in jar

I have a code snippet that is part of my eclipse plugin. When testing it in a runtime eclipse version (That means it is not packed into a jar afaik) it runs just fine.
However if I pack my plugin into a jar and then run the respective code snippet it results in a complete crash of eclipse without any error logs (I'm assuming that it even crashes the JVM).
I'm running this on Linux Mint.
According to this post the Desktop API is broken in older Java versions but it should be fixed in Java 8.
Has anyone an idea why this is still happening?
Although this is not an answer to the question why the Desktop API breaks down when used inside a jar file, I want to point out an alternative that I have found (thanks to #Holger) for my case (working with the eclipse APIs):
You can simply use PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(<YourURL>); in order to open the given URL in the system's default browser.

Java on OS X: "open" command won't run if .app package contains a JVM bundle

I'm trying to create a self-contained Mac app from a Java application. I've set up the .app directory, configured the Info.plist file, baked in dependencies as well as a Java runtime. I am successfully able to open the .app and launch the program and everything works except for one peculiar piece of code:
ProcessBuilder pb = new ProcessBuilder("open", "/Applications/TextEdit.app");
pb.start();
When I launch the .app, this code does not seem to run or at least do anything. If I open the package contents and launch the .jar, it runs fine. I managed to narrow it down to happen only when the .app contains a Java runtime bundle. Since running a .jar uses the system's Java and running the .app uses the bundled Java, this has got to be the reason I'm struggling.
The version of my Mac's installed Java JDK should be 1.8.0_77.
The bundled version should be 1.8.0_74. I grabbed it from the Moneydance application as I used it for reference when making my .app.
Any help is very appreciated as this should be the final step to release it. I created this question to be more specific than my other question here.
So I'll answer this myself as the issue was somewhat on my side.
The bundled JVM I was using (that I had copied from the Moneydance application) was the culprit. I suspect that the creators of Moneydance might have stripped their runtime bundle of features their app doesn't use in order to reduce the file size. Whatever the reason, my issue was fixed by creating my own bundle.
I did so by copying /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk to MyApp.app/Contents/PlugIns/. After that I edited the Info.plist key called JVMRuntime to use the entry jdk1.8.0_77.jdk. My app now uses this JDK instead of the bundle I previously had, and open now works as it should.
Apologies for not doing my homework, but thank you to the people helping. I found the issue while writing reproduction steps, so I might not have found it without you. I guess all I can say to those who might experience something similar is to check your JVM bundle.

Run tomcat with Eclipse on Mac

I know that this question has already been asked a couple of time but any answers helped me to fixed my own problem. Like I said I am working on OSX Mavericks and I would like to use tomcat with Eclipse JEE. Here is exactly what I did :
- I downloaded Eclipse JEE for mac.
- I downloaded Apache 7.0.47 on http://tomcat.apache.org/download-70.cgi
- I put my folder in /Library/apache-tomcat-7.0.47 and I created a symbolic link in this same folder that I named tomcat
- I tryied to configure it with Eclipse but when I start the server an error message occur :
"Port 8080 required by Tomcat v7.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)."
Do you know which process is using the port 8080 on mac OS and how to kill it ?
I tried to start the server on another port by changing it in eclipse in port 8081. But still nothing appear on localhost:8081.
I tried to launch appache with the terminal by typing : "/Library/Tomcat/bin/startup.sh" and still nothing happened, my web browser just tell me : "no data received".
I hope I have been understable and hope somebody could give me an issue.
I've not tried this on Mavericks, but I have used Tomcat 7 with the previous two versions of Eclipse on Lion and Mountain Lion.
• Be sure you are using the correct edition, Eclipse IDE for Java EE Developers Eclipse IDE for Java EE Developers not "Eclipse Standard 4.3.1" or "Eclipse IDE for Java Developers" nor any others. In theory you should be able to add plugins in order to get the equivalent, but that has never worked for me nor for many other folks.
• After downloading Tomcat, run it through the BatChmod app, turning on the checkboxes to clear the filesystem meta-data. By default, file permissions will block Tomcat from running on a Mac (in my experience at least).
• Test Tomcat by itself. Drag the "startup.sh" into a Terminal window and press Return to launch. Later drag the "shutdown.sh" into the same window to stop. Point a web browser to this address to see Tomcat's welcome:http://localhost:8080/ (Tip: You can trash all the .bat files when running on a Mac.)
• No need for symlinks. You should not have to do anything to at all to Tomcat, except the BatChmod. The trick is to configure a new server within Eclipse. The goal is to make Eclipse aware of your Tomcat folder. I'm sorry I cannot remember exact steps at the moment. Doing the configuration is not as easy as it should be – nothing in Eclipse is as easy as it should be.
• You may need to start from scratch. Trash Eclipse and all of its config files, settings files, etc., both visible and invisible. Do some googling to discover their locations.
• Beware that you should not share the "workspace" folder between versions of Eclipse. Others have advised that major (annual) versions of Eclipse are not completely compatible with their settings, prefs, and such.
• There may be some issues with Java 7 on Mavericks -- you may want to check the Apple Java Developer mailing list.
If you have a choice, considering using other tools instead of Eclipse. Eclipse is arcane and fragile. My first choice would be IntelliJ, though you'll need the commercial (not free of cost) version to do web server work. I only used Eclipse because of its plugin for Vaadin. Another choice is NetBeans which is easier to setup with Tomcat than Eclipse (and now has a good plugin for Vaadin btw).
Tip: I put Tomcat at the root level of my current user's home folder, just to keep things simple.

Categories