Error Could Not Find or Load Main Class - java

Using NetBeans IDE 7.3.1, I modified a desktop application under Windows 7, using JDK 1.7. Performed clean and build, and tested this application under Windows 7, Windows XP, and on a MAC. All test scenarios run under each operating system performed as expected.
This app is ported to outside vendors, and all vendors, except for one, have loaded and executed the app without any issues.
The one vendor encountering problems, and running under Windows XP, returns an error message - "Could Not find or load main class". After doing a little research, this error usually indicates the JDK is different. They downloaded and installed JDK 1.7, but the same error message appears. I had them go to http://javatester.org/othertesters.html, making sure that java was working on the workstation and verifying the java version (1.7). They reinstalled JDK 1.7 and still receive the same error.
I have duplicated the error by removing JDK 1.7, loading JDK 1.6 and running the app. Receive error ("Could Not find main class"). A little different than what they receive, but basically the same problem. Removed JDK 1.6, loaded JDK 1.7 and problem disappears.
I'm at my wits end! I am going to make an appt. to access their workstation. But before I do, I would like to put a plan in place to try different scenarios to fix the problem. I don't know how to proceed, since I've run out of options. I'm hoping for any suggestions.

OK,
Problem solved. Sent application via outlook, modifying executable file from .jar to .txt b4 sending application. I didn't think about looking in compressed LIB directory. Four files were .jar files.
These files were quarantined. Renaming these files to .txt b4 compressing app would have eliminated the problem. Resent the zip, vendor extracted and renamed all .txt files to .jar. All is well.
Appreciate everyone's input.

I believe they still have a JDK 1.6 on their machine and use this, for some reason, to try to execute the application. I've seen this various times at customer workstations.
Very often, people are not aware of what they have installed. Tell them to remove all JDKs and JREs from their workstation, by way of uninstallers and looking into the program folder and deleting stuff manually. Tell them how to do it. Do this with them during a phone call.
Then have them reinstall JDK 1.7. I'm almost sure it will work afterwards.
Alternatively, you can compile the application for older JDKs. You can also do this using JDK 1.7 by setting the target version for the classfiles.

Make sure that their JAVA_HOME path is pointed towards the JDK 1.7 install. I have had similar issues where I had multiple JDKs installed, needed to use the latest, but the computer was pointing to an older version.
To find what version the java_home is type java -version in the cmd.
How to find java_home: How do I find where JDK is installed on my windows machine?

Related

IntelliJ Cannot start under Java 1.8.0: Java 11 or later is required

I had some problems with JRE versions, so I tried to change it using the plugin Choose Runtime. I changed it to Java 1.8.0_112-release-287-b2. Now, when trying to start IntelliJ, i get an unsupported Java version error: Cannot start under Java 1.8.0_112-release-287-b2: Java 11 or later is required. I have tried to modify the runtime path in the ide64.exe.jdk file, but it seems like the old jdk IntelliJ ran on has been deleted. I also tried reinstalling intellij, no luck either. Anyone know how to get back the JDK? do I just download it from oracle and install it in the IdeaIC2020.3\jdks\ folder?
Thanks,
Jakob
I went to the jdks folder and deleted all contents. This fixed the issue. IntelliJ started without a problem.

Running ECLIPSE on a memory stick

I'm trying to run Eclipse (Neon 1) on a memory stick. In a first time, the problem was the JVM 1.6 installed on the machine which is too old. To use a compatible JVM, I created a jre directory in Eclipse's directory and placed in it a JVM 1.8 (the last one found on ORACLE's web site).
Now, when I try to run Eclipse, nothing happens. I got the splash screen with "Eclipse Neon 1" then, nothing, not even an error message.
What is the problem and what can I do ?
Important note : I can't install a JVM on the "native machine" as I'm not administrator.
Than, you for all your answers. Have a good day.
When you need programs to run off a USB, always search if a portable version exists first. This is a working portable version of Eclipse Neon but it is another version though.
Finally, I found (one of) my mistake.
I used a jre(...).exe. It's the problem. I downloaded the tar.gz file of the jre and unpacked it. Then, I used the jre of this unpacked version and everything was ok except a problem with an "access restriction" to some libraries.
I fixed that last problem with that question on StackOverFlow. And now, everything is ok !
Great ! Thank you to everyone for your help.

Java runtime enviroment missing even when updated

So, i have been looking for the answer for this but i havent found anything, and i cant just ignore it
the thing is that i have created a windows applicaction on Eclipse, and it works on my pc, now i want it to run on my customers pc but when i try to open it there it pops up an error.
I have been trying on my computer, unistalling all java folders and subfolders and i just resolve the problem by installing the latest java version
So i updated my customers pc to the latest java version, now we both have 1.8.0_91-b14 jre after checking on the cmd
Im bundling this specific version on launch4j jre + a minimum jre 1.4.0 jsut in case and im still getting the same error:
"This aplicattion was configured to bundled Java Runtime Enviroment
but the runtime is missing or corrupted"
any ideas?
on my program folder i dont add any jre folder, i guess its bundled inside the .exe am i wrong? i just have my exe, libraries(jars) and some config
it works on my pc so im pretty confused, and i found it difficult to know whats wrong

Running Multiple Java Versions

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.

Runnable Jar made in Eclipse, Doesn't work on pc's without JDK installed

I've made a little snake game and exported it into a runnable JAR file through Eclipse.
It works perfect in machines with JDK installed (with regards to the environment variables and all that.)
But "normal" people don't have that installed, only the JRE that can be found here: http://java.com/en/download/index.jsp
This is insufficient to execute the JAR apparently. I've tried numerous approaches:
packeging libraries in Jar
Extracting libraries in Jar
Build with java 1.7
building with java 1.8
checked the build path to make sure the libraries is included.
At best I get a "Java Exception occured" on the other PC (the one with JDK installed).
I've then tried to run the JAR on my own machine through cmd with the command...
java -jar fileName.jar
...in the hope that I would get an error log, but nope, it just runs the JAR like there's no problem.
Any ideas on how to make the JAR run on a machine with JRE installed?
Thanks in advance
Check packr
Packages your JAR, assets and a JVM for distribution on Windows, Linux
and Mac OS X
Appareantly, build for jre7 fixed the problem, why it can't run jre8, i don't know..
The JDK includes a tools.jar (among many others) which are omitted from the JRE. In your project expand the JRE System Libraries and make sure none of the libraries are coming from the a JDK.
Also adding some example text of the exact error you're seeing would really help us know what's going on. Stating "Java Exception occurred" is the equivalent of telling a doctor you don't feel well.
For what it's worth it's not a good idea to use classes from the JDK in your code as it has stricter licensing than the JRE.

Categories

Resources