how to add hadoop jar file avail in another computer(Ubuntu) using teamviewer, to run java program in windows eclipse.
TeamViewer doesn't affect your Java classpath.
Download the hadoop jar file and add it as a library to Eclipse. Or, better, use Maven/Gradle rather than messing with JAR files yourself.
Ubuntu / Windows doesn't matter. Java is cross platform
Related
I have some gradle project on java. I know, how to build .exe artifact by Launch4j from .jar. Also I know how to create .msi installer by gradle plugin 'setup-builder' (uses wixtoolset), which installs project folder with java libs and main .jar file inside. Now I want to combine both points but I can't find information how to realise it. Is it possible? If yes - how to do it?
Or maybe is there other way without wix/launch4j?
You can use Inno Setup, which creates an .exe installer. It's very useful because you can include some other program within the installation (like MySQL installer or Java installer). http://www.jrsoftware.org/isinfo.php
I built .jar files of my application. Now I want to share them with my friends.
Do I just copy that .jar file over to my friend's system? If not, what else has to be done?
yes your can share the .jar file by just copy to the new system
if he/she is installed the particular version or latest version of java he/she can run that application
you can also wrap the .jar files into .exe file using some third party applicaion
In your comments you stated that the .jar files are unzipping and not running on your friends' computers.
This is usually caused by Java not being installed on their computers. They should get the Java SE Runtime Environment from Oracle and install it. Afterwards, the jar files can be run with a double-click.
If your friends already have Java installed, they might have to fix their file associations (so .jar files no longer open with their ZIP tool).
Yes if you created an executable jar it is possible to execute it if the operating system of your friends supports java.
If they need only to use your jar as a library they can import it in their project.
Yes just copy it to your friends machine. That is what jar files are made for.
The reason behind , your jar file is being opened as a zip file , may be your friend have set some unzip tool as a default application to open jar files. Try to open it with JAVA .
I'm new at Java for Mac developement and I spent a lot of time finding a way how to create an installer. It's strange but it's not too much information about it. All the ways lead to using of JavaAppLauncher. (I use appbundler-1.0.jar and Ant to build .app) But I faced a following problem.
JavaAppLauncher sets working directory to user folder. My application consists of several jar files, resources and configuration files. All of them located in Contents/Java inside the .app structure. I use relative paths to them, relative to the executable jar with Main class.
I googled 2 discussions only, where someone asked how to set the working directory inside the .app bundle. Threre is a way to sed -Duser.dir JVM option in plist file of .app bundle. I tried this and it behaves strange. When I use "new File(".").getAbsolutePath()" - it shows the directory I pointed in -Duser.dir parameter, but when I try to create file on disk or read file from disk - it still goes to the user folder as it was by default.
May be someone knows what is wrong there?
Or is there any better way to create a java application bundle for Mac?
Thank you, guys.
Use JarSplice to create OS X app bundle. Compile all your jars and resources into one jar file and export as mac .app file.
Deploying Java Applications can be a pain if your application has multiple jars and native libraries. There are the options of using Java Web Start or Java Applets however these are not always suitable.
Executable Jars are an option, however if your project has multiple jars or native files then it can be tricky to use this option.
JarSplice attempts to solve this issue by allowing you to merge all your jars and native files into one, easy to use executable jar file.
Features:
Creates a single executable fat jar via an easy to use GUI.
Automatically extracts only the native files needed for the OS the jar is running on.
Automatically cleans up any extracted native files after the application quits.
Add VM arguments on jar creation which removes the need to enter them via the command line.
Optionally create a Shell Script (.sh) launcher for Linux with embedded fat jar.
Optionally create an OS X App Bundle (.app) for running your application.
Optionally create a Windows Application (*.exe) for running your application.
This is the best cross-platform installer creator i have found yet. You can get the java executable from here
In the existing projects where I'm working I see that there are Java EE jars like j2ee-1.3.jar existing, but when I try to download from Oracle website (1.6 version) I only see .exe available. So how are they connected, is it like exe after installation will create jar in the installation folder?
I checked the contents of exe with WinRAR but could not find any jar.
Also I have the same question regarding exe of JRE and adding it as external jar to eclipse project.
I suppose you are talking about the JDK installation executable file... So yes you guessed part of the answer, the JDK installation file for windows systems is an executable file that will do nothing but downloading and unpacking the JDK/JRE which is a set of java libraries jars (which you use for your development) in some directories you specify in installation steps.
This is the mains ubject of you question, but note that you will not only find jars when browsing the JDK installation directory, but a lot od other bunch, mains to be cited:
The java process uses for runnig your application.
The javac binary file used for code compilation... and many other staff
.jar is a library /package of Java and when you are on oracle to download it's application of java i.e. jdk or jre.
So when we do programming jars are used to add functionality, we will have to import classes from it.
when we want to use external classes then we have to use it's jar file.
when we do any import like import org.springframework.beans.factory.annotation.Autowired; it came from jar or dependency.
You can make executable jar file of java program, you can find out tutorial for it online. so whenever you click on that executable jar file in any machine where jre is installed you can access it. This is called Executable Jar, and you are telling about Java EE exe is setup application for New Fresh Java Installation.
I have created a java application in eclipse, wich needs comm.jar and jexcel.jar and .property files so i have added to libray. I want to make a jar file out of my java appliction, including the external jar files added to the appliction.
How can I do it? To run serialport programs I have copied win32.dll into java_home/bin and comm.jar into java_home/jre/lib and javax.comm.properties into java_home/jre/lib, but when delivering the product it should run only by needing the jre.
How can I solve this? Please help me.
Thanks in advance,
suma
Although your question is not totally clear I suggest using the Fat Jar Plugin should allow you to achieve what you want.
You can use File > Export > Executable Jar which includes all libraries. There is also a checkbox to generate an ant build file as well as the jar in order to customize it further (I for instance make all the paths relative and remove the main-class flag).
You have two "path" issues. The Java Classpath and the path from which dlls are loaded.
If you were using a Java EE app server or OSGi then controlling these paths is addressed by the respective runtimes. Both Java EE and OSGi are likely to be overkill for small projects.
In which case you are delivering:
Your application JAR
The dependent jars
The DLLs
I suggest that on installing your app you place these artefacts into a suitable directory structure, for example .../myapp/lib for the jars and .../myapp/bin for the dlls. Don't copy them into the infrastructure directories, for example the JRE lib and bin, or into Windows32 - that just leads to version nightmares and mysteries when someone installs a new jre.
Having got that structure, how to control the paths? For the classpath, look at the Manifest.mf file. tutorial
For the DLL path, I know of no good alternative to setting OS level environment variables ** before ** launching the JVM. Hence you need a little batch/shell script to launch your app, setting the PATH appropriately.
You can also check maven.
You can right click on the project and say "Export". Now select "Java" in tree of choices. Under that select "Jar File". It'll guide you through the process and will allow you to export you project as a jar file.
Hope thats what you are looking for.
The recently released Eclipse 3.5 has a Export as runnable Jar which allows to put all dependent jars in a subfolder to the jar file, and get the Manifest right.
It is an adaption of the FatJar plugin. Works nicely!