I'm developing Java code in Eclipse IDE.
I wrote ANT script for export it in some JAR files.
Now I'd like to import these JAR files in Lotus Agent through ANT script too.
But I don't know how to do it :(
I found this topic, but I don't understand how it can help me
How to build a Lotus Domino Database using SVN and Ant, Maven or Gradle
Rombs,
The headless designer command-line you mention in your post will take a whole Notes Database which has been stored in a source control system (and this means it has been translated to hundreds of small files instead of being one monolithic file) and then 'compile' it into an nsf. I don't think you can do this for a single agent.
If you want the jar files to be available to a single database, then I am afraid the only way is to do this manually, either into a Java Library or directly into the agent.
Another possibility which could work if you have access is writing the JAR files directly into the 'magic' paths on both your server and your notes client.
jvm/lib/ext
However, there are security issues involved because any code which is in this path is considered absolutely safe and will run without any restrictions. If you have a godd admin, he will definitely not be happy about this and will probably want to have a long look at your code.
If your server is at least 8.5.2 then a cool option would be to deploy your jars as an OSGi bundle (tip from Stephan Wissel, haven't done it myself)
Related
I'm very new to java. I'm developing a tool that checks if your PC meets some set of specifications. This included writing and executing a separate batch file and including an API (SIGAR) for the model of the CPU.
My problem is that when I tried exporting it to Runnable JAR in eclipse, and I ran the resulting JAR from command line, it gave me lots of 'DLL not included in build path' Exceptions. After including the folder that contains the API DLL in the build path, I got similar exceptions. The thing that fixed it was adding the folder containing the DLL to environment variables (PATH) in Advanced System Settings.
Questions:
The JAR now works fine on my computer, but what about the users who download the JAR? Will they also need to add the DLL to environment variables? If so is there a way the JAR can do that for them?
My JAR won't run with a double-click, but will run from command line. Is there any way around this that will carry over to users who download the JAR too?
If the user downloads the tool and can't run it because they don't have the right version of the JRE, will the tool notify them? If not, is there a way around the user having to update JRE or will wrapping as an EXE suffice?
Thanks in advance, much appreciated. Lots of questions.
Q1: The JAR now works fine on my computer, but what about the users
who download the JAR? Will they also need to add the DLL to
environment variables? If so is there a way the JAR can do that for
them?
You can put a DLL inside a JAR file:
How to make a JAR file that includes DLL files? (Hint: read both answers ... completely.)
However, when you distribute a JAR containing a DLL, you then have the problem that different platforms require different DLLs (or whatever). Even with Windows you have the problem of 32 bit versus 64 bit DLLs.
Q2: My JAR won't run with a double-click, but will run from command
line. Is there any way around this that will carry over to users who
download the JAR too?
You cannot address that problem in a JAR file. The "double-click to run" functionality is implemented by the OS. The best way to provide this kind of functionality is using (platform specific) wrapper scripts that are double-clickable.
Q3: If the user downloads the tool and can't run it because they don't
have the right version of the JRE, will the tool notify them? If not,
is there a way around the user having to update JRE or will wrapping
as an EXE suffice?
Unless you have a JRE installed, the JAR file is just a passive blob of data. (A ZIP file, actually).
If the user has a JRE that is too old, then either the JRE will be unable to load any classes in the JAR (because the classfile version number is wrong), or you will get errors because of missing (system) classes.
The only hope would to do something like providing a wrapper script to launch your application that checked the JRE version before attempting to launch the JAR.
As a general rule, if you want to do fancy stuff like this you need to distribute your program in an installer, not as a bare JAR file.
Is there a way to bundle a spring-boot application into one executable jar including a JRE?
I think I saw someone doing that (Josh Long?) which resulted in a jar you could start via java -jar foo.jar and even with ./foo.jar
I googled for this the last hour but couldn't find any documentation on this, anyone there to help me out?
EDIT:
I just found what I saw at the conference. spring-boot 1.3 introduces something called executable jars, which wrap the jar with a shell script.
Enabling this makes it possible to run your jar like ./my.jar and tying it to an unix init system.
However, you still need java installed at your host.
Enabling this feature in gradle is as easy as adding this to your build.gradle
springBoot {
executable = true
}
You should think about using a Java installer / wrapper which will create a native binary which contains your code / jar and the JRE (some solutions can even download a JRE for you)
The positive side effect is that you (if needed) can create solutions for Linux, Windows and Mac.
If you want to stick to a simple Linux only solution you might want to try this: Bash script containing binary executable
Propably you are using Maven. This maven plugin allows you to create single jar file with all dependencies. Next you can use tool such as jwrapper which allows to build executable file with embeded JRE for many platforms.
I've written a program that uses opengl that I have been running without issue form within eclipse, and I now want to package it up into a jar for deployment.
I'm using maven to manage all the dependencies and the build process. I've done a clean and package to build a jar with all the necessary dependencies, but I'm having trouble getting it to actually run.
It seem to be looking for files outside of the jar file, for example gluegen-rt.dll, which I can see is in the jar at the top level. It also seems like it's trying to reference a version of my jar with '-natives-windows-amd64' appended to the name.
When I try and run it I get the following error:
D:\My Documents\workspace\Cube\target>java -jar cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar 10 OPENGL
Catched FileNotFoundException: D:\My Documents\workspace\Cube\target\cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar (The system cannot find the file specified), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file:/D:/My%20Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName
cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar): [ file:/D:/My%20Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar -> file:/D:/My%20Documents/workspace/Cube/target/ ] + cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar -> slim: jar:file:/D:/My%2520Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar!/
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: D:\My Documents\workspace\Cube\target\gluegen-rt.dll
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:551)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:96)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:414)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:388)
at com.jogamp.common.os.Platform$1.run(Platform.java:209)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:83)
at ui.jogl.JOGLCube.init(JOGLCube.java:52)
at ui.jogl.JOGLCube.<init>(JOGLCube.java:44)
at ui.jogl.JOGLCubeController.<init>(JOGLCubeController.java:19)
at core.Cube.getVirtualCube(Cube.java:37)
at core.Cube.<init>(Cube.java:27)
at core.Cube.main(Cube.java:56)
I have no prior experience working with OpenGL so any help would be greatly appreciated.
Thanks for reading
You won't be able to get your application in a single jar. JOGL is a pretty sophisticated library of several jars (and optionally DLLs, too) that must be installed correctly in the same folder as your application jar.
I don't know exactly how to set this up in Eclipse (my experience is Netbeans, which IMO is a much more robust build environment) but the issue is that the DLLs for the native part of JOGL are not being found. JOGL uses a slightly crazy method: the DLLs are packaged in jar files, and the library dynamically expands them in place at run time, then attaches them. The name of this file for your architecture is jogl-all-natives-windows-amd64.jar. In general, you should have all these jars with names of the form jogl-all-natives-*.jar in the same directory as your app's jar file.
The problem with the above is that the user of your app must have write permission in a place from which DLLs can be loaded. This can conflict with many enterprise security policies (enforced e.g. by Active Directory push). If you have a wide user population, this will not work for enough users to cause serious pain. The app I've been working on must run in schools internationally. There is no way the all-in-one JAR mechanism can be used for this.
The other way forward is to use the separate native DLLs in the lib folder of the jogamp distribution, placing them in a lib directory that's on the java.library.path of the application.
In all cases, you will need an installer to place the multiple jars, DLLs, and perhaps other files of your system in the right places. I use NSIS for this. It's not as polished as a commercial installer builder, but it's good enough to do multi-jar Java app installers. If you want to check out the way my JOGL app handles installation for Windows and Mac, see Bridge Designer and Contest.
A final note is that if you don't have perfect control over the machines where your app will deploy strongly consider packaging a Java Runtime in your installer. Dealing with the gajillipon ways users can dork up java installation is not much find. A built-in JRE makes the download package much bigger, but in my experience, this causes much less pain than the alternative of dealing with what's on the user machine.
This information (albeit in a not so readable format) is documented on the JOGL deployment Wiki.
I do it for my game (Truly Unusual Experience of Revolution®). It's currently supported. Please look at this page of the wiki:
http://jogamp.org/wiki/index.php/JogAmp_JAR_File_Handling
You have to follow a certain layout to allow GlueGen to find your native libraries for JOGL, JOAL and JOCL:
http://forum.jogamp.org/Packaging-JOGL-projects-to-be-cross-platform-tp4031261p4031286.html
If your project is under GPL, feel free to look at my Ant target "create-jars" in my Ant build script:
http://svn.code.sf.net/p/tuer/code/pre_beta/build.xml
You don't need to set the Java library path, you don't need to use the DLLs, just use the JARs containing the Java libraries and those containing the native libraries.
Keep in mind that the defaut archiver (Ark, WinRAR, ...) might open your JAR when double-clicking on it instead of running your application. I advise you to wrap your JAR into a native application bundle. You can use Packr, Launch4j or NSIS to do so. My script above uses my Ant target "create-app" (inspired by Packr, still using its native launcher) for Mac OS X to create a .app zipped file. Good luck.
P.S: If you're "bothered" by my use of the GPL, you can look at my tutorial for JogAmp's Ardor3D Continuation that deals with this aspect.
I have a Swing desktop application and have created a jar file which depends on library (which is kept in ./lib/) and a .txt file in the same folder. Now to execute the jar I have written a .bat file which checks if Java is installed or not. If installed then I run the jar file with command:
javaw -jar TagEdit.jar
Now there are two problems I am facing with this:
I would rather prefer a single executable, if possible.
As using bat file, the console is visible in back (looks kind of weird). Is it possible to turn it off?
Java is everywhere, and there are lots of applications that are built in Java and packaged in a setup, or given as exe. I Googled a lot but could not find a way to create a setup for the software or an exe. How are those software packaged?
Have tried jlaunch, but could not get that to work correctly.
Himz, Eclipse can automatically build a so-called "fat-jar" for you. It is a jar that contains all the dependencies you need.
If you are a happy Maven user, then you have two brilliant alternatives - the shade plugin, and the assembly plugin. They both can produce a "fat-jar" for you. :)
There are various answers to this.
javaws.exe will execute the jar without the console appearing behind
But I feel this isn't really the best way.
I think should investigate using Java Web Start, So you create a JNLP file and have it jar downloaded from the web, I think, you can also have a desktop icon.
If you don't want that
I think you can get/buy binary wrappers for the jar.
You could convert it to an executable. Try Googling java to exe.
Once that is done, you could package it up as an installer using NSIS.
I have recently learnt how to program in java, I was looking at some open source programs from sourceforge.net and after downloading these programs I don't understand the file structure most of the programs follow. Pretty much every program has src,bin,lib etc folders, how do I know the standard way of organizing my program. Is there any book or resource which explains this? also how do I compile this source code once I have downloaded it, to make a jar file from it
thanks
src is (usually) what it sounds like: source code
bin is (usually) shell scripts related to the product
lib is (usually) external dependencies needed for compilation
Most projects document how they build: look for a README or grok the project website. These days for a Java-centric project I would expect Ant or Maven.
What you have downloaded is actually a distribution version of the program. The directories as listed by carej are kind of a convention, mainly derived from how things are usually done on a Unix system.
Most projects supply some manual on how to build. This can be tricky if not all libraries (jars) used by the program are supplied in the distribution. Some of the Apache Commons project do it like this, thus forcing the user to download dependencies seperately.
If you just want to use the program try to find a binary version. This will usually consist of jars, scripts and documentation. Source distributions are useful if you want to look at the source and/or make modifications.