Sci2, Eclipse and "Unable to acquire application service" on Windows 10 - java

I have downloaded the Sci2 application (an Eclipse based tool for bibliometrics) and installed it on two Windows 10 systems. On one system (the desktop) it starts up and runs without a problem. On the other (a new laptop) it fails to start with the following error in the log file:
java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started
The commonly suggested solution to include "org.eclipse.core.runtime#start" in the config.ini file does, not surprisingly, not work as the first (identical) installation on the desktop computer runs as expected, and thus the config.ini file is correct.
It obviously must have something to do with differences in what else is installed on the two systems and how the systems are configured, but I cannot figure out for the life of me where even to look for the source of the problem. The Windows versions on the two systems are identical, as are the Java versions installed.
Also noticed that on the working desktop system, the application creates additional directories (after startup, not during installation) in the configuration folder:
org.eclipse.core.runtime
org.eclipse.equinox.app
.settings
These folders are not not being created on the other system (the laptop). Just copying these folders over unfortunately does not resolve the issue either.
Any help or suggestions would be highly appreciated.

After playing around with 32-bit / 64-bit version of Sci2 and Java, and reinstalling the 64-bit JRE, the application starts up again as expected.
Still don't know the specific issues that caused the problem, but at least it works now. Must say the error message in the log file is very confusing.

Related

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.

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.

Jar works from cmd - not from double-click (additional library)

I seem to have a strange issue which is most likely to be caused by not understanding how the including of additional libraries in java work.
I wrote a program that uses jnetpcap.jar to work with pcap files. The application is running fine when I start it from eclipse and has also worked many times by exporting a runnable jar (copying required-libraries to sub-folder). It even worked on other computers.
As mentioned in jnetpcap doc, the computers running windows have put jnetpcap.dll into C:\Windows (according on every machine the x86 or x64 dll)
Anyhow, the following scenario is reproducable on my and other machines:
running the complete eclipse project works
running from cmd with java -jar pcapdump.jar works
double-click jar the gui etc. works - but the "main work" is not done, so no pcap file is used.
I don't see any errors in my logs.
Configuration in eclipse:
added an external user library. pointing to my local jnetpcap.jar and source-jar.
When exporting as runnable-jar with copying libs to sub-folders the jnetpcap.jar gets copied into a separate sub-folder. Like I did it many times before.
Anyhow the described problem exists today and I don't know what I am doing wrong or what may be wrong.

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.

Simple swing application. The jar file runs on my computer, but not others

This is my first question, so apologies for any mistakes. I'll try and give all the info I can. Basically I've written a simple swing application which just loads in image into a JPanel and displays it. I'm using Netbeans 7.1 and I have the latest version of the Java SDK.
Anyway, I've used the "Build" feature in NetBeans 7.1 to deploy my application into a Jar file. When I double click the Jar File on my PC, it runs without a problem. However when I put it on other computers (Tested on 2 others so far, both with the most current JRE) it fails to open, citing the following error:
could not find the main class: swong.Startup. Program will exit
swong is my package name, and Startup is the location of my main method. I have checked the manifest file which is created with Netbeans' build, and it[the manifest] does indeed contain the location of my main method class.
From searching, I've come across similar issues in which the classpath is set wrongly, but I don't understand how this could cause my particular error.
If someone could help me, I would be over the moon. I've been studying java for a year or so, and I've got a good handle down, but I've NEVER been able to make a Jar that runs on a computer which wasn't my own. So, 10 points and thanks in advance.
xo.
EDIT: Thank you for the responses. I'm doing shift work and swamped, but I will test and poke with these responses tomorrow and provide more information. Thanks again. xo
I had d same problem while distributing my app. There is 1 solution that you create a batch file with 'java -jar AppName.jar' and asking user to double click on this batch file to execute your app. What i did was to provide a JRE installation exe(eg: jre_1.7.0) with your app.
Now create a Batch file (install.bat) in which write following commands
jre_1.7.0 -> this will install jre on user's pc
set path="C\Program Files\Java\jre_1.7.0\bin"
java -jar yourAppName.jar
Why i installed JRE because different people have different JRE versions installed. So this makes it difficult to set path to the installed JRE's bin folder & calling the 'java -jar' command. Hence as you know which folders your JRE installation will create hence it is easy to set path and execute your jar file with 'java-jar' command.
Check that your jar file has the following structure (at least)
jarfile.jar
|---------- swong
|---------- Startup.class
|---------- META-INF
|---------- MANIFEST.MF
It seems like the class "Startup" is missing. Maybe your jar only contains the .java files, not the compiled classes.
This error message can be a mistakable java7 error, when you try to start java7 compiled classes with a different Java Runtime Environment then java7. Have you validated, that your .jar is started within a Java7 environment on those other test machines? Sometimes it happens, that you have installed different versions of JREs and you might not be sure which one is actually started.
To check which enviroment is used, you can check in your registry for the following value:
HKEY_CLASSES_ROOT\jarfile\shell\open\command
this should point to your latest JRE. Or if you'd like to stay compatible to java6 as well, define the appropiate compile level in your build environment.

Categories