I created a jar file from netbeans of my java application which is displaying mysql records. I am trying to run it on another computer which doesnt have netbeans but rather java SE. I fixed a major minor version issue by installing a latest java SE version. It is now running the jar file by now the next issue is it is giving me the java.lang.classnotfoundexception: con.mysql.jdbc.Driver
I tried to copy the mysql-connector-java-5.0.8-bin into second computer as well, but no luck.
Actually I need a solution where I just copy the jar file and able to run it as a server. I want to install it on multiple computers on the site, which might not allow me to install netbeans from internet.
Related
I am trying to incorporate Apple's script engine in my java app developed for macOs. I use eclipse to develop and when I run a debug build from eclipse all the Apple Script functions work.
As soon as I export it to an external jar and run that on the same machine they do no longer work.
I've searched and found some issues which I all tried, here is a summary:
using getEngineByName("AppleScriptEngine") now.
Adding the META-INF file javax.script.ScriptEngineFactory with the contents: apple.applescript.AppleScriptEngineFactory
cleaning and rebuilding several times
I opened the jar to see if the META-INF file is present and it is.
searched in /System/Library/Java/Extensions/ for a applescript jar file but it was not there.
I also searched for the /Library/Java/JavaVirtualMachines to see if it is there but also not the case
It is still not working. So I do not know what the difference is exactly between eclipse debug run and running a jar in macOs but there has to be something I am missing.
As far as I can figure out it seems that the apple scripting class is not installed but then how does eclipse use it?
As I understand there is a difference between java JRE versions so I am in need of a solution for all of them because I do not know what systems are running my app.
Any help is appreciated!
I know there are tons of these questions. I have been through a lot. I have been stuck on this issue for >24 hours.
I am using:
Windows 8.1, 64bit
Eclipse as IDE
Tomcat 7
I want to do:
Make a small website with 4 pages that loads data from an sql server and some other simple stuff. The java code works if I run it as plain java in Eclipse.
The code also works if I run it in the JSP project with java 8 on localhost.
However, I need to host it on a java 7 server. I cannot update the server.
First I tried just uploading it anyway (by exporting to .war and uploading that), but that did not work. Then, I set all settings (preferences/java/compiler, preferences/java/installed JREs) to java 7 while using java 8. Projects are not overriding the default.
Setting my localhost to java 7 settings makes the localhost JSP unable to work too (same error), but it still works in plain java on my computer.
I have tried cleaning temporary/compiled files to force a recompilation (project/clean). I have done this every time between trying new things.
I am importing the classes to the JSP server using:
<%# page import="jdbc.Publication"%>
<%# page import="jdbc.SQLPublicationMapper"%>
and these are the names of my classes. The classes are in the WEB-INF\classes folder in the JSP folder. I copy them from the jdbc\bin\jdbc folder from the other project after compiling them.
There are no compilation errors.
There are no relevant warnings. They all concern HTML formatting stuff.
I have tried to completely uninstall java 8 and only have java 7 installed (JRE and JDK), but still I get the same error. Yes, I have recompiled the files after this.
I am running out of ideas to try. This makes no sense to me.
I am not normally a java developer, I code in R/python/php/js, so please give answers I can understand.
Any ideas?
Turns out the solution was something more mundane. Apparently the server was not appropriately using the .class files I had given it. These were the files I was updating. Instead it was relying on an old .jar file containing the same classes. Thus, I thought it was using the class files, but it was instead using this old .jar file. This .jar file was exported from java 8. Exporting a new version of this file fixed the issue.
TL;DR Make sure eventual .jar files are also updated, not just .class files.
I have a problem with getting the Application to run on other People's machines.
I have tested a self contained and the normal .jar file.
When i pass them to a friend of mine who has java installed, when he opens the .jar file, there is an Error: "Java Exception has occured".
When i run both the .jar and the .exe off the self contained one, both do work on my PC.
So the actual question is:
Why isn't it working just like that?
Can't i just run JavaFX applications without installing the whole JDK?
Thanks for your help :)
Since Java 7 there exists the "javafxpackager", renamed to "javapackager" on Java 8 which uses some xml-configuration for generating your wanted "Installer"/distribution-package.
As this does not fit some peoples need, there exists a way to use maven:
the javafx-maven-plugin, you can find some examples about the usage of that plugin as linked.
Disclaimer: I'm the maintainer of the javafx-maven-plugin.
I need to undate an .tiff image using Java.
There are 4 jars on oracle site to download the jaiImageIO jars.
jai_imageio-1_0_01-lib-windows-i586-jdk.exe
jai_imageio-1_0_01-lib-windows-i586-jre.exe
jai_imageio-1_0_01-lib-windows-i586.exe
jai_imageio-1_0_01-windows-i586-jar
I downloaded all the four jars, but when I try to run first one i.e jdk.exe getting error "Jdk 1.4 or higher is required" but I already have jdk1.7 installed in my system. Can anyone please suggest me how should I proceed. While running jre.exe its working fine.
Try jai_imageio-1_0_01-lib-windows-i586.exe. it will install libs on your machine. .exe with jre/jdk suffixes will always check for certain JRE/JDK.
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?