I'm unable to export a runnable .jar file.
When I export the java project (using the eclipse export wizard) and then try to run the resulting .jar file I only get errors that jwgl library can't be found!
What can I do to get a working .jar file?
Thanks in advance!
Regards Fleckdalm
You can export runnable jar with maven. Just run
mvn package
and projectname.jar and projectname-jar-with-dependencies.jar will apear under target directory.
Related
Is it possible to convert an OSGI project to jar?
I tried to export as a runnable jar using eclipse, But it did not work because launch configuration didn't show up.
I am creating a simple Alljoyn java application to send and respond to a few signals. When I run the code in Eclipse (on Win7) it runs fine. However when I export it as a runnable jar file and attempt to run that I get the following error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no alljoyn_java in java.library.path
The exception is triggered upon calling executing the following code:
static { System.loadLibrary("alljoyn_java");}
I have configured the build path of the project to use the external jar alljoyn_java and set the Native library location of that library to the parent directory of the alljoyn_java.dll file.
You have to place the files alljoyn_java.dll, alljoyn_java.lib and alljoyn_java.exp in the same directory of the jar file.
Then, run the jar with the following command:
java -jar -Djava.library.path=. [your-jar-file.jar]
The JVM looks for native libraries at path specified in java.library.path (as mentioned in answer above) and/or path specified in environment variable LD_LIBRARY_PATH. Either use the command mentioned in comment above or add path of directory containing your library to environment variable LD_LIBRARY_PATH.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<<path_of_dir_containing_lib>>
java -jar <<your_jar_file>>
So what I ended up doing is downloading jarsplice and using that to add the native libraries after I exported the project from Eclipse as a .jar
I have some Clojurescript source files that output messages to the browser console on a timer. Eventually I would like to make a Clojars library from these files. So far I have created an uberjar using lein. All the user of this library would need to do is :require a namespace from the library, and messages should be emitted to the browser console. Seeing these messages is the "all working fine" test I want to perform.
In other words how do I check that the jar file I have created works? Can I start off with a fresh lein project and just put the jar file in some special 'un-managed' directory and :require the namespace? Actually I don't think you can do such a thing with lein, hence the question.
Assuming you have a project.clj file already with the line
(defproject bigco/biglib "0.1.0-SNAPSHOT”
...
run
lein install
This will build the JAR and install it in your local Maven repo.
Then in your new project, add that dependency and run it.
If your jar (definition of jar includes uberjar of course) does not come neatly from a lein project then an alternative is to use Maven 2 directly:
mvn install:install-file -Dfile=./my-deps.jar -DgroupId=my-deps -DartifactId=my-deps -Dversion=1.0.0 -Dpackaging=jar
Here mvn will store the jar in your local .m2 maven repository. Once stored you can use this jar in any lein project on your machine by referring to it in the dependencies section:
[my-deps "1.0.0"]
Maven documentation for this.
Can anyone help on issue below?
Not able to SBT run portXX using Scala on Windows
java.io.IOException: Cannot run program "grunt" (in directory "C:\Prashan
t\projects\project-frontend"): CreateProcess error=2, The system cannot find the file specified
Please go to Intellij file "Grunt.scala" file in Project-Build folder and you can change file name "grunt" to "grunt.cmd" and it worked for me.
I have no idea why, but when i export my java program into a Jar it just wont run. There are no errors when building or running it. When I run the program through eclipse it work perfectly.
Anyone had this problem before or care to take a look?
regards,
Matt
As Shark said, it has to be exported as an Executable JAR file. Just exporting your project to a JAR is insufficient.
Here's a nice write-up on making Executable JAR files:
http://www.mkyong.com/java/how-to-make-an-executable-jar-file/
If you want to make it from Eclipse, Export as Java | Runnable JAR.
windows 8 installed java 1.6 without the correct paths. I installed jdk 1.8 and it worked.