I've made a word-processor named StoryTeller in Java (a first - beta version, which I'm still working on improving) and put it online for others to test out and use.
I've gotten a response saying they were unable to open it. I've built and run StoryTeller on Windows 10 OS and it works fine. After generating the jar file, I used Inno setup to generate an installer for the program. You can find the file I've uploaded here. Here's the message I got about it:
Hello! I was going to try out StoryTeller on my Macbook today, but unfortunately it didn't work. The file automatically gets opened in
"Text Editor" where encrypted text shows up along with the error
message "this program must be run under Win32".
I downloaded it on my old computer earlier this week (it has windows
7) and the download process and installation worked perfectly fine,
but I was unable to open the program when the installation was done.
It appeared on my desk as a Java-symbol (the icon) and nothing
happened when I clicked on it. Both my OS are quite old (Macbook from
2010 and the other computer from 2012), but I've still updated them as
much as possible and installed all the latest versions available of
necessary programs, so I'm not sure whether the problem lies within my
computers or StoryTeller itself.
Do you have any ideas how I can fix this? I would really like to try
StoryTeller since it seems to be a great concept that could really
come in handy when I work on my novel.
Could anyone help, please, understand what may be the issue here? Thanks.
First, check if your JDK is 32-bits and make sure to advice your future users have a 32-bit JRE installed. This way, it may work properly. I think 64-bit Java apps can't run atop a 32-bit JRE;
You can bundle a proper JRE/JVM with your software;
Make sure you are referencing ANYTHING with absolute paths inside your code. This could make your software throw several exceptions when running somewhere else;
For instance, Inno-setup commonly generates Windows-only .exe setups. Installing your software in a Mac would require you to generate a .dmg or .pkg (this one you could create through PackageMaker extension from XCode here (require registration, more info here
Kappy on Jul 5, 2012 6:28 PM says: Go to connect.apple.com and search for "packagemaker." Of course you must first be logged into your developer account.
))
For Linux, you can provide a simple shellscript bundled with your .jar (even with a discrete JVM) in a .zip or .tar.gz file, and ask your future users to run the provided shellscript.
Good luck!
Related
I'm trying to get Eclipse 4.5.2 running on Macs with OS X 10.10.5 and Oracle Java 8u73 I got to the point where trying to start Eclipse results in
The JVM shared library "$JAVA_HOME/bin../jre/lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol.
Googling this returns a whole bunch of suggestions, none of which work. Some say you absolutely MUST have the JDK (I'm using the JRE). Others emphatically say the JRE is all you need. Some suggest editing an Info.plist or another, with people responding "Yeah that worked!" right along with "That didn't work"
How do I get past this message?
You need the JDK because, well, to be honest Apple hates Java and has done a thorough job of screwing up what used to be the best OS for Java development.
The "you need legacy Java" message was from OS X, not Eclipse. The advice to download and install it is bad advice, but sadly nothing that Eclipse can remedy. Installing "legacy Java" just reverts your system to a VERY outdated JRE and renders much Java-based software, including Eclipse, broken.
Eclipse requires Java 7 or above (this year's release of Eclipse packages in June will require Java 8 ), so the best thing is to download JDK 1.8 (not just the JRE), install that, then point your eclipse.ini file to it's exact location per the instructions at the eclipse.ini wiki page.
Oracle JDK download links change often, so it's best to Google for "JDK 8 download" and you'll find it. Here's the page as it stands at the time I'm writing this.
[quoted from this Eclipse forums message]
I'm working on a program that utilizes Caprica's VLCJ Bindings.
This is fine and good for Windows and Mac, as I can just package the VLC Libraries for them in a zip file and output them to the user machine where appropriate.
The problem comes when I need to do this for Linux, because, dear god,
there are ELEVEN. SEPARATELY COMPILED. APPLICATIONS/LIBRARIES.
And some of them even have their own flavors. It's like the Baskin Robins of OS's (I knew there were a few but I've only really ever run Ubuntu so I was not prepared for this).
If I was a masochist I could totally make this work and end up with a gigantic jar with an absurdly huge number of zipped Linux libraries within it, but I really, reHEHEHEALLY do not want to do that.
So I figured that the best course of action to take would be to check if LibVLC is installed, and if it is, reference it directly, and if it isn't, install it at run time (before the library tries to load itself), or, heck, even at launch/install time for the Java program.
Is this possible? I know that on Ubuntu using the terminal it would be something similar to
sudo apt-get install vlc
and there's probably 15 different flavors of that, which is fine, I can deal with that, but is it possible to do that from within a running Java application (and wait until it's finished before moving on), and if so, how can I go about doing that, and if not, how hosed am I?
To detect if LibVLC is already installed it's possible to do that in pure Java simply by searching the file-system using Java File IO. The idea is you'd look for "libvlc.so.*" in "/usr/lib" and/or other "well-known" locations.
vlcj provides a NativeDiscovery class that will do this for you:
boolean foundLibVLC = new NativeDiscovery().discover();
You can find Javadoc here.
You could then throw up a dialog box to prompt the user to install vlc using their package manager.
Or you could detect the OS by using Java File IO to read "/etc/issue" and if it were Ubuntu you could launch a process to run "apt-get install", or a different package manager for a different distro. I've used Apache Commons-Exec to do this sort of thing before.
There's simply no universal package manager you can assume across the different distros.
I know it's not ideal, but this is what I do for my projects.
To be fair, if you're targetting users on Linux you're likely to be targetting more technically savvy users than most and they would likely have no problems installing other software.
A further option I suppose is to ship the VLC source code with your project and have your installer build VLC. It takes a while to build VLC from scratch though, and there are lot of third party library dependencies that must be installed first.
I suppose on Linux, the 'correct' thing to do is to create a distro package (like a .deb or .rpm or something), declare a dependency on VLC, Java and JNA and do it that way.
Hopefully someone can help me because I am apparently brain dead. I have searched and read through a lot of this forum as well as others for help in resolving my problem and I am just not getting it.
I have 2 Java WebApps that I need to run for Johnson Control HVAC units. The one unit is old and strictly requires Java 1.6.0_21. There are no upgrade options available for this unit. Just hundreds of thousands of dollars to replace the whole system. But the system works just fine so I am not interested in replacing it.
Now I have another unit which my company just took over at another location that uses a similar control unit but runs on Java 1.7.0_49 or 69 I can't remember. I have both versions installed on my computer but only the newer unit with Java 1.7 works. My older one now comes up with Unable to Launch Application Error. I have tried all these things and either I am just plain doing it wrong or something else that I am not catching is up.
I tried going into the Java Control Panel and unchecking Enable 1.7. That had no affect, even after rebooting.
I went into the Environmental Variables and under Path I have no Path to Java. So I added the path to the Java 1.6 version which also had no affect.
I have a batch file on my desktop to run the older app because it's web URL is a mile long. In this batch file I tried to add set JAVA_HOME variable and a set PATH variable for Java 1.6 which also had no affect.
I tried just doing java -version:1.6 from the cmd prompt which also did not allow the program to start.
I got it so when I did java -version from the cmd prompt it would tell me 1.6.0_21 for the version but I still can't get the program to load.
So I uninstalled 1.7 from the computer and tried it again. Still would not load the program. I had to reinstall the 1.6 before the older program worked. But once I reinstalled 1.7 I was back in the same boat.
I tried re-installing both programs using the STATIC=1 command through cmd prompt and still only version 1.7 runs and the older 1.6 does not.
I do get a message when I try to load the 1.6 that says, the program has requested an older outdated version of the program. Open with new version recommended or open in the older requested version 1.6.0_21. I select open in the older version but still get the Can Not Launch Application Error.
I have also tried going into the advanced settings and unchecking Internet Explorer for the Browser in the 1.7 control panel and going into the 1.6 control panel and checking Internet Explorer.
What am I doing wrong here or what am I missing? Any help would be appreciated.
This is a Windows XP 32 bit computer. Nothing special, just a word processor mostly.
You are swimming upstream, but it isn't a very large or strong stream, and this can be done.
The upstream part is that most instructions for doing this assume you are going to run only one version of the JVM on a given machine.
The good news is that Java doesn't require this, and is not set up so that it is difficult to run two at the same time. You just have to be rigorous about where each of them get their information.
I would recommend not "installing" EITHER of them. Do not put the executables' or the libraries' directories on your path variable, and do not define a CLASSPATH variable on the machine globally. You will need to unpack a runtime environment for each JVM, each in their own directory tree.
Make one batch file to run each version. It will define its own path variable, and its own classpath (either with SET CLASSPATH= or using the classpath JVM argument).
Good luck.
I just wonder if I use launch4j to convert jar to executable (exe file) on Windows. If I take the executable (and other created files if there is any) to another computer which doesn't have JRE installed and I don't have administrative permission, will the executable file still work? Many thanks!
-updated from here-
I didn't try launch4j yet and from reading doc I didn't quite understand really and I didn't think I get my answers. Reading english literature is very different from reading a technique doc. I have a very limited IT knowledge.
I did do a bit search here. I found someone says launch4j is just a wrapper and still need jre installed in the end user's computer, but the the post was 4 years old. So after some research I'm still not 100% sure if I need install jre in the destination computer. For me if jre is an absolute need in the destination computer, then I can forget about using launch4j as I know I won't get jre installed there. However I got a feeling launch4j maybe can somehow bundle jre with the exe file and the exe file can then be run on any computer without jre installed. I'm just trying to confirm things I'm unsure about.
So the answer I'm looking for is
1) yes still need jre installed, then I can't use launch4j
2) no you don't need jre installed, then I will learn how to use launch4j
3) depends, then I will probably give a try
However, I don't think I should be punished by being marked down because my lack of background knowledge. Although the original post does look like some random post. Thanks.
So for beginners and people who don't have an IT background like me, here's the definite answer for my own question.
"Hi guys.
I just wonder if I use launch4j to convert jar to executable (exe file) on Windows. If I take the executable (and other created files if there is any) to another computer which doesn't have JRE installed and I don't have administrative permission, will the executable file still work? Many thanks!"
"Hi,
The JRE is still required, the executable will not work without it. However, you can bundle the JRE with your application so even if the user does not have Java installed it is possible to run the app.
Best regards,
Grzegorz"
"Thanks Grzegorz!
And just a small question if you could briefly explain. I noticed you used the word "posssible", does that mean there are some cases you still can't run it?
I will try it out anyway cheers!
Joe"
"No, there are no special cases here, if you bundle the JRE it will work.
Cheers"
original post is here at this Link
Cheers!
I made a simple text based game that runs on my computer, but my schools computers have an older version of java and can't run it. I tried compiling the .java file in from the computers command prompt but I can't access where the javac folder is to compile because the school computer blocks everything. The command prompt is even disabled by the administrator unless I open it with a batch file. I tried wrapping the jar with the JRE in Launch4j but the exe does nothing, it loads and that's it, nothing comes up (I think it's because the text game is supposed to run in the command prompt so there is no GUI to print any of the text)
How to get a Java program to run on a computer without modern JRE?
my schools computers have an older version of java and can't run it
Use the cross-compilation options of javac when compiling it at home.
You are running into a bit of a contradiction here; Please take notice on what exactly you are asking:
"How can I run a Java Program without Java?"
Do you get it? You are basically asking "How can I drive a car without the car?"
As for the actual problem, all hope is not lost. Here are some options:
If possible by any means, simply install the latest stable version of Java on the machine.
From a computer that has JRE/JDK installed (or through another form of access to the JavaCompiler, AKA JavaC), recompile the code to the older version of Java using the command-line parameters for source and target java versions (Note: I am unsure if the JRE/JDK for the older version must be installed in the machine or not).
For this case, you might want to take a look at this and/or this.
Choose another language to work with, and re-do your code into that language; You can't run Java code without Java, the same way you can't travel by train without the train to travel with.