Can't create Mac executable from Eclipse Java - java

I am updating a 100,000 line Mac OSX application from 2010 that uses Eclipse Galileo and whatever version of Java was current at that time. The application controls several educational telescopes.
When I try the Eclipse "export to Mac application bundle" menu item, I get an output called MicroObservatory.app, but inside there are only the info.plist, some icons, and the "MacOSX" folder and the "Java" folder, but the "MacOSX" folder and the Java folder are empty!
I tried following a tutorial using appbuilder, but I found out that it was no longer current, couldn't be downloaded from the Oracle site, and was replaced by ORacle's "jpackage" - however, when I try to run "jpackage" I get an error message saying "unable to find a Java Runtime that supports jpackage", despite my having reinstalled the latest Java, and also set the path variable "JAVA_HOME" to usr/bin/java, which is where Java resides.
Creating an "executable JAR" gives me a runnable application (!) which can be run by invoking "java -jar MicroObservatoryRunnable.jar", which shows that java is there and everything can be run, however it doesn't get my a clickable application with an icon. Can anyone suggest what the problems could be? The 12+ years ago versions of Eclipse and Java created a "Mac application bundle" according to the notes I have from that time.
I have had to make many modifications to the Java code, and the goal is to have it running on new Macs with the latest OS and Eclipse and Java, so going back to the old versions is not an option.
Thanks so much ! (My native language is C, and mostly I developed embedded systems, such as the telescopes that are run by this software, so sorry I am not that Mac literate.)

Related

The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted error

I have an Owasp Zap program that was working fine on java8, Windows 10. Recently, I upgraded to Java 11 as our automation project will not run on anything else. I have removed Java 8 folders from my C: drive and edited the environment variables and everything works fine except for Zap, which gives the error:
This application requires a Java Runtime Environment 1.8.0. The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.
I went to my registry but under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\ there was only references to the 11.0.5 jdk
I don't have anything in my environment variables pointing to the old jre as far as I can verify.
I don't have java 8 in Control Panel\All Control Panel Items\Programs and Features, although maybe when I deleted it, I deleted manually and should have ran a cleanup program.
Following some advice here, I looked for a jvm.dll file in Runtime Lib in my registry, but I don't even see a Runtime Lib. I also don't see any of the other java related folders other people mentioned finding in their registries that fixed this problem for them. This is what my registry looks like:
Also I noticed in Control Panel > Programs, there is a link for Java referring to the Java Control Panel, but it is a blank file icon, and when I click it, i get the message "Application not found"
Unfortunately, IT took my admin rights so I can't uninstall and reinstall Zap, but I'd love to solve this this weekend if it's possible.
I have uninstalled the old runtime and download the offline installation from https://www.java.com/en/download/manual.jsp. After installing the offline installation it's working fine for me.

Cannot uninstall Java

First off, I've been trying to launch Eclipse but I kept getting the below error
Failed to load JNI shared library "C:\Program Files (x86)\Java\jdk1.8.0_25\bin...\jre\bin\client\jvm.dll"
So I looked through this thread
Failed to load the JNI shared Library (JDK)
The sensing I got was that I might want to uninstall Java and make sure I have the right 64 bit version, since I already have a 64 bit Eclipse.
I went ahead and went to uninstall the Java Update files via the control panel, which went fine.
Then when I tried to delete the Java files in my Program Files (x86) folder, I can't do it as the "file is being used by another process"
Now I can't install a new version of Java as I get an error code 1603 owing to the incomplete Java files, and I still got my JNI shared library error to fix.
I'm really stuck now. What do I do?
If you use 64 bit eclipse, you need a 64 bit operating system and 64 bit JDK. Close your eclipse and JDK, remove X86 JDK and install 64bit JDK.
ctrl+shift+esc open task manager and end all processes that are opened by java. Sometimes when you run java and your applications don't close properly, java run-time environment is still running. So you have to force java out of that state. Next time, i'd just install the newer version of java right on top of the old one. Because the installation process removes the old version of java for you and replaces it with the newest one.
with jframes using the code
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
this is essential to your program so it closes completely.

How can I create a Java .app bundle for Max OS X on my windows build machine

I have a SWT based Java application that works on Windows, Mac OS and Linux. I develop it on my Windows machine and have a tester with Linux and a tester with a Mac. Currently my process creates a runnable .jar file for each platform on my Windows machine (which references the platform specific .jar and lib files from Eclipse.org). I have a working installer for Windows - also produced by the build on the windows machine. I want to create a standard Mac OS installer for my Mac users. The right way to do that appears to be to create a .app bundle and distribute it via a dmg file. This has not being going well. I have a working Java app that uses SWT and can be run from the command line, on all platforms. I have a way of building a .dmg on Windows. But so far all my attempts to get a .app bundle to work have failed.
I started by following this tutorial: http://www.eclipse.org/swt/macosx/
But when running my application I get an error saying that applications for the Power PC are not supported. That is using the same binaries that work from the command line using java -jar so the problem must be in the the way I am bundling. The sample Hello app from the page also fails to work but with a different error message.
I have been searching all day and found this promising talk: http://www.parleys.com/#st=5&id=2891&sl=72
In that talk the speaker says there will be a way to create a Mac OS .app bundle on any platform using a standard java launcher. But I cannot find any such thing released yet.
I found this post that also looks promising: http://www.intransitione.com/blog/take-java-to-app-store/
But this recipe says it will not work except by building on a Mac OS machine.
What I want to do is create a .app bundle for Mac OS X on my windows machine along with the Windows install and the Linux install. It would be preferable to also include a jre as part of the app bundle (which I already have working for Windows and Linux). I hope someone can point me in the right direction.
Have you seen this?
The .app is just a directory with a special structure a few special files. Once you have it created, you'll only need to update the JAR each time you build, which can be found here: MyApp.app/Contents/Resources/Java/MyJar.jar.
There will also be a few Java-specific properties in My.app/Contents/Info.plist, but you probably won't need to change these from how you initially set them up.

loadlibrary issues in Java

so I have this project in java that uses a jni .dll i wrote (which i've aptly named jniusb) that gives access to usb-hid devices. i've been using it for several months now without any notable issues until yesterday when i tried to launch my program from the jar instead of directly from netbeans. after a little debugging i characterized my issue as follows:
clicking on the jar icon starts my program without loading the dll. displaying the error messages in my gui revealed "no jniusb in java.library.path" even though i copied my dll to the java binaries folder (which always seemed to work in the past).
i tweaked the code to find the current directory and use "System.load" (with the dll copied to the same folder as my jar) instead of "System.loadLibrary". this approach threw the error "C:\Users\bpaik\Documents\NetBeansProjects\JniUsb\dist\jniusb.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform". this made me scratch my head since i am most definitely working on an AMD 64-bit platform and running out of netbeans works with the same dll...
running the jar from the command prompt (with either java.exe or javaw.exe) loads the dll just fine. i thought that maybe this meant that i was having admin privileges issues so i tested the theory by going to the java executable and granting admin privileges, but this did not change anything. (and i'm also pretty sure i've used load/loadlibrary before without admin...)
i am no java expert so i've pretty much exhausted my debugging abilities and am now hoping that someone with a little more experience than i will recognize the issue i've described, thanks.
UPDATE: so i've fixed the problem but I still have no idea what is going on. i did a x86 build of my .dll and threw it into the folder with my jar and everything loaded/worked just fine. so i guess somehow (even though i set the default program for my jar to be the x64 JVM) the jar i built with the x64 library in Netbeans is running in a 32-bit JVM. to sum things up:
my jar is built with the x64 library in netbeans and runs fine with the x64 dll when launched from the command prompt.
when launching the jar from the icon (with default program set to x64 java) my program and JVM somehow switch to a 32-bit JVM and work fine when i use the 32-bit version of my dll.
trying to explicitly run my jar with the 32-bit java doesn't work at all. my gui doesn't display and the command prompt briefly opens/closes...
Problem 2 is certainly caused by you running a 32-bit JVM. Netbeans presumably runs a 64-bit JVM. You'll need to use something like Launch4j to get the right JVM loaded (or include both a 32-bit and 64-bit version of your DLL).
From the command line, try -d32 and -d64 to test that theory out.
Do you have multiple versions of Java installed on your Machine? It appears that when you run the jar by itself, your machine is creating a 32-bit VM for it. Open an command prompt and type java -version to check which version of Java is being used.

Ubuntu 11.04: Running MARS simulator

I am trying to run the MARS simulator in order to do some Assembly homework in Ubutnu 11.04. MARS(jar file) requires Java to be installed and so I did install Java.
After that I typed
java -jar .jar
and as a result I got:
Failed to load Main-Class manifest attribute from .jar
What must I do in order to run this file properly?
There are different Java implementations and you are not using the "official" one. (As is clear from the libgcj.so that appears on your error) and that one tends to be the most reliable.
Ubuntu 11.04 might still have the java-6-sun package (it was deprecated on newer Ubuntu releases because of license conflicts), so you should try with that one.
If that java is not in Ubuntu, then you can try downloading and installing Java from the Oracle site.

Categories

Resources