I have a simple jar application that works properly when double-clicked directly, but crashes when run as a .app.
The Mac console/system error application shows an Exited with code 1 which means there's an error.
I tried adding the WorkingDirectory key/value to the plist as recommended by another stackoverflow question (cant find it again... hmm), however that didn't work.
I'm trying to find a way to capture the errors/stacktrace so I know what the actual problem is, and not just shooting in the dark.
Update #1
After much digging, I found a way to execute the java portion with some debugging:
$ export JAVA_LAUNCHER_VERBOSE
$ ./YourApp.app/Contents/MacOS/JavaApplicationStub
This allowed me to discover that the main class path was incorrect in my POM. Such a silly mistake.
However, while opening the application works with the above command, launching the .app with a double-click gives an error -600
Well, seems I've worked this out myself.
Doing the following allowed me to see the stack trace, which led me to the fact that my <mainClass> for mac app bundle plugin was incorrect.
$ export JAVA_LAUNCHER_VERBOSE
$ ./YourApp.app/Contents/MacOS/JavaApplicationStub
The eventual -600 error I was getting was cleared away by doing a mvn clean and mvn package.
Related
I have problem with running my java GUI program using cmd on Ubuntu Linux. When I run it using IntelliJ it works just fine, but using cmd breaks it.
From my research I have understood that the problem might be caused by me downloading the 'headless java version'.
So I d like to ask how can I solve this problem. How to mby reinstall it correctly or something that would help.
Thx a lot
I tried:
java -jar TIcTacToe.jar
But, outcome is:
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
at java.desktop/java.awt.Window.<init>(Window.java:553)
at java.desktop/java.awt.Frame.<init>(Frame.java:428)
at java.desktop/java.awt.Frame.<init>(Frame.java:393)
at java.desktop/javax.swing.JFrame.<init>(JFrame.java:180)
at TicTacToe.<init>(TicTacToe.java:7)
at Main.main(Main.java:3)
I am expecting to be able to run my .jre file using cmd.
When I try to run a code snippet in Java Scrapbook, Eclipse cannot start the VM with the following error:
Unable to launch scrapbook VM
Exception occurred executing command
line.
Cannot run program "C:\Program
Files\Java\jdk-14\bin\javaw.exe" (in directory "C:\tmp"):
CreateProcess error=206, The filename or extension is too long
There was a bug report in Eclipse's Bugzilla, but it was closed without a satisfactory answer.
The other similar answers on SO have different causes:
Starting in directory with an unusual name
Starting in an Android project
I tried changing the working directory to C:\tmp so that any issues caused by directory structure are solved, but to no avail.
Environment: OpenJDK 14, Eclipse 2020-06, Maven project
The actual problem is that Windows cannot start a program whose command line is longer than about 32000 characters. This can happen if you have so many dependencies that the command line arguments reach the limit. This is why changing the directory to C:\tmp did not help, the size of this part is negligible when compared to all the dependencies on the command line.
There's a nice answer to a different question which contains some useful tips which can help out.
I initially worked around the issue by running the code snippet in a newly-created project, but this was only possible because I did not need any parts of the project I'm working on.
The real solution was to switch to Linux because pretty much all distributions have limits which exceed those of Windows by an order of magnitude or more.
I'm having quite a bit of trouble with ./gradlew. I am trying to make a 1.14.4 mod, and have been having a lot of problems with gradle, but I've finally got gradle working (an error in my build.gradle code). I'm on a Mac, and my friend (with whom I am building the mod) is not, and running
./gradle wrapper
works fine on his computer but not on mine. It must be a system issue, but I'm really not sure. The error I keep getting is:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type FileHasher using BuildSessionScopeServices.createFileSnapshotter().
I've looked online, and all of the work-arounds I have found doesn't help me. Running ./gradlew wrapper with --info I get this. Running with --stacktrace, I get this. Finally, with --debug I get this. I don't know if these are helpful (I'm sure they are, if you know what to look for).
Any insights into what on earth is causing this is greatly appreciated!
P.S.: my made-up username in the pastebin links is drdeducer :)
P.P.S.: it isn't just ./gradlew wrapper that doesn't work; it is ./gradlew <anything>—even just ./gradlew!
Found the problem for me. In the process of trying to initially get gradle working, I added touch ~/.gradle/gradle.properties and specified org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-12.jdk/Contents/Home. Typing /usr/libexec/java_home -V you will get a list of your Java versions, so in my local gradle.properties, I had to specify a Java version less than 11 (it ended up being open adoptopenjdk-8.jdk). To see Java versions, type brew search java, and then brew cask install <desired java version> (for mac users).
I had installed Java in my PC and it was working perfectly. Suddenly something went wrong and now I m not able to open swing applications and its showing the error 'Java not found'. But I can run the Eclipse IDE which also needed Java to run. So I decide to reinstall the Java, but when I tried to uninstall the Java it shows the Error 1723 - There is a problem with this Windows Installer Package. So I have installed a new JDK in another location and set the PATH. Still I am not able to run the Swing application.
Can anybody help me on this?
How are you running your swing application?
If it's from the command line like java mySwingApp and you're getting java not found then your PATH isn't set properly. Make sure that the java/bin directory is on your PATH not just the top level directory. You can test your PATH by just typing java in a console window - it should print the java help page.
If you're not running from a terminal like above, then you may need to set a JAVA_HOME environment variable which points to your java installation folder. Here's a tutorial on setting JAVA_HOME
Setting JAVA_HOME
Hope this helps,
Will
This is close to jakob's answer, about trying to get your Java install setup correctly again, just with a little more detail.
I had a similar problem on my Windows 7 box where I was trying to uninstall Java and do a clean install of a newer version. Something got messed up and I would get the 1723 error message during the uninstall and attempted reinstall. Here's information about how I was able to fix the problem, and maybe this will help you:
Look at the log files for the uninstall/reinstall. On Windows 7 they can be found at c:\users\username\AppData\Local\Temp\
The java_install.logdidn't show any extra information, but I had several MSI##### log files that contained error messages about the failed uninstall. The message was: Error 1723.There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action UninstallJRE, entry: MSIUninstallJRE, library: C:\Program Files\Java\jre6\bin\regutils.dll
There was indeed no regutils.dll file, and not even the bindirectory was there. So I copied over a regutils.dll file from another computer, ran the uninstaller, and it worked. Then the new clean install of Java also worked.
So take a look at your logfiles and hopefully that will give you more detailed information about the 1723 error.
This usally happens when you delete Java files manually.
If you try to uninstall Java and it fails, it generates a log file.
Should be in C:\Users[Username]\AppData\Local\Temp
Almost at the end the missing file(s) can be found.
Try to copy that file(s) from a working installation to your computer.
Then you should be able to uninstall your Java and install a new version.
I'm trying to learn Java and I'm having problems with the appletviewer command. I am using openSUSE 11 and am able to compile and run normal java programs but when I issue the appletviewer command I'm getting the following error "bash: appletviewer: command not found".
I have set the PATH variable in the .bashrc file. so the problem is not that of the path. This can also be verified from the fact that javac and java commands are working normally. I have googled and tried many said resolution but none is working. I have even tried moving the files to the bin folder and running the command from there.
So what may the cause of this? Isn't appletviewer designed to work in linux? And FYI I have replaced the OpenSDK and IcedTea versions with the jdk1.6.0_14 version from the sun site. Please help.
Thanks
Chris
As a test, do the following:
$which java
$which appletviewer
Check to see if the paths are different. If the second command gives no output, appletviewer may not even be installed (or can't be located by your system).
You need to install java-1_6_0-sun-devel-1.6.0.u14-0.2.1
$ sudo zypper install java-1_6_0-sun-devel
You will find it in the openSUSE-11.1-Non-Oss repository.