I am trying to load the JRI in my webstart-application. I always get this exception:
Cannot find JRI native library!
Please make sure that the JRI native library is in a directory listed in java.library.path.
JNLP file:
...
<resources>
...
<jar href="JRI.jar" />
...
<nativelib href="JRI.jar" />
</resources>
...
I use a batch script to run my application under Windows 7:
set R_HOME=C:\ProgramData\R\R-2.14.0
set R_PATH=C:\ProgramData\R\R-2.14.0\library\rJava\jri
set JNLP_URL=http://localhost/app/app.jnlp
set WEBSTART="C:\Program Files\Java\jre7\bin\javaws.exe"
SET PATH=%PATH%;%R_HOME%\bin\i386;%R_PATH%
%WEBSTART% %JNLP_URL%
I try to use an sh script to start my application under Linux (Ubuntu):
#!/bin/bash
export R_HOME=/usr/lib/R/
export r_home=/usr/lib/R/
export rHome=/usr/lib/R/
export rhome=/usr/lib/R/
export rHOME=/usr/lib/R/
export R_PATH=/usr/lib/R/site-library/rJava/jri/
export r_path=/usr/lib/R/site-library/rJava/jri/
export rPath=/usr/lib/R/site-library/rJava/jri/
export rPATH=/usr/lib/R/site-library/rJava/jri/
export rpath=/usr/lib/R/site-library/rJava/jri/
export WEBSTART=/usr/lib/jvm/java-7-oracle/jre/bin/javaws
export JNLP_URL=http://localhost/app/app.jnlp
export PATH=$PATH:$R_HOME/bin:$R_PATH
$WEBSTART $JNLP_URL
For some reason it does work under Windows, but not under Linux. The two batch scripts should do the same...
The application works fine under both, Windows and Linux, until I try to use a method which tries to use R.
It also works completely (including R), when I start my application with the following sh script as a non-webstart version:
#!/bin/bash
export R_HOME=/usr/lib/R/
export rPATH=/usr/lib/R/site-library/rJava/jri/
export JAVA=/usr/lib/jvm/java-7-oracle/jre/bin/java
LIB=<<Libraries>> # I left out this very long line for this post :)
$JAVA -classpath $LIB:. -Djava.library.path=./FAST:$rPATH de.app.MainWindow $*
I have no clue why it is not working with webstart and Linux...
A jar -tvf JRI.jar gives me:
0 Sun Oct 07 12:28:14 CEST 2012 META-INF/
68 Sun Oct 07 12:28:14 CEST 2012 META-INF/MANIFEST.MF
0 Sun Oct 07 12:28:12 CEST 2012 org/
0 Sun Oct 07 12:28:12 CEST 2012 org/rosuda/
0 Sun Oct 07 12:28:12 CEST 2012 org/rosuda/JRI/
1079 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RVector.class
582 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RMainLoopCallbacks.class
2158 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RList.class
1723 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RFactor.class
10424 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/Rengine.class
734 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RBool.class
1010 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/RConsoleOutputStream.class
3082 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/Mutex.class
9887 Sun Oct 07 12:28:14 CEST 2012 org/rosuda/JRI/REXP.class
190345 Sun Oct 07 12:28:12 CEST 2012 libjri.so
JaNeLA gives me
XML encoding not known, but declared as utf-8
'short' description is longer than 'default' description.
and for every resource jar I specified I got (example for persistence-api-1.0.jar):
Downloads can be optimized by specifying a resource size for 'persistence-api-1.0.jar'.
The resource download at persistence-api-1.0.jar can be optimized by removing the (default) value of download='eager'.
The resource download at persistence-api-1.0.jar can be optimized by removing the (default) value of main='false'.
It might be possible to optimize the start-up of the app. by specifying download='lazy' for the persistence-api-1.0.jar resource.
Lazy downloads might not work as expected for persistence-api-1.0.jar unless the download 'part' is specified.
All those notices are green or yellow.
Related
I have created a GUI Javafx app and exported it to a jar file. The GUI app is working fine. After creating this app i have moved it to linux system and it is working fine here. Now i want to run this GUI app in linux using services so that i can make this service run at start of linux system.
For that I have created a pointless.sh file which on run runs the jar file. It is working perfectly the code for this pointless.sh file are
java -jar GUI1.jar
on Runinng this script i.e. "./pointless" the GUI is shown on the screen.
Problem starts when i try to make a service for it.
I made a service for it in /etc/systemd/system pointless.service
[Service]
ExecStart=/home/mandeep/Documents/pointless.sh
on running sudo systemctl start pointless.service nothing happens and the status shows following errors.
● pointless.service
Loaded: loaded (/etc/systemd/system/pointless.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-07-06 13:44:00 EDT; 25min ago
Process: 1449 ExecStart=/home/mandeep/Documents/pointless.sh (code=exited, status=203/EXEC)
Main PID: 1449 (code=exited, status=203/EXEC)
Jul 06 13:44:00 debian systemd[1]: Started pointless.service.
Jul 06 13:44:00 debian systemd[1449]: pointless.service: Failed at step EXEC spawning /home/mandeep/Documents/pointless.sh: Exec format error
Jul 06 13:44:00 debian systemd[1]: pointless.service: Main process exited, code=exited, status=203/EXEC
Jul 06 13:44:00 debian systemd[1]: pointless.service: Unit entered failed state.
Jul 06 13:44:00 debian systemd[1]: pointless.service: Failed with result 'exit-code'.
Update !!!
Step 1
As expected I created a simple Java app helloworld and exported it to jar file. I ran this file as java -jar helloworld and It worked.
Step 2
I created a simple service for it and service also worked as expected.
the service codes are
[Service]
ExecStart=/usr/bin/java -jar /home/mandeep/Documents/helloworld.jar
Output
Jul 07 17:08:13 debian systemd[1]: Started pointless.service.
Jul 07 17:08:13 debian java[2765]: Hello World!
Step 3
I Updated service back to GUI1.jar to check original problem posted.
code
[Service]
ExecStart=/usr/bin/java -jar /home/mandeep/Documents/GUI1.jar
and again it shows the error
Output
● pointless.service
Loaded: loaded (/etc/systemd/system/pointless.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-07-07 17:14:37 EDT; 4s ago
Process: 2816 ExecStart=/usr/bin/java -jar /home/mandeep/Documents/GUI1.jar (code=exited, status=1/FAILURE)
Main PID: 2816 (code=exited, status=1/FAILURE)
Jul 07 17:14:37 debian java[2816]: at com.sun.glass.ui.Application.run(Application.java:146)
Jul 07 17:14:37 debian java[2816]: at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
Jul 07 17:14:37 debian java[2816]: at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
Jul 07 17:14:37 debian java[2816]: at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
Jul 07 17:14:37 debian java[2816]: at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
Jul 07 17:14:37 debian java[2816]: at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
Jul 07 17:14:37 debian java[2816]: ... 5 more
Jul 07 17:14:37 debian systemd[1]: pointless.service: Main process exited, code=exited, status=1/FAILURE
Jul 07 17:14:37 debian systemd[1]: pointless.service: Unit entered failed state.
Jul 07 17:14:37 debian systemd[1]: pointless.service: Failed with result 'exit-code'.
Found the answer
Made following changes under [Service] in pointless.service
a) use "Environment=DISPLAY:=0"
b) declare "User=<user>"
and under [Install] optional
c) declare "WantedBy=<user>#.service"
I have a JNLP/Web Start application on a secure apache http server (no Tomcat - do I need it?). It has been signed with the free keystore I generated by java. When I launch it, I get the following error:
For security, applications must now meet the requirements for the High
or Very High security settings, or be part of the Exception Site List,
to be allowed to run.
I have added the location to the Exception Site List (with a trailing slash to include all subdirectories and files) but I continue to get this error.
Of course it won't work in Chrome. I have tried launching the jnlp file from the command line, the URL from Firefox and Internet Explorer and they all give me the same error.
I have obtained a certificate and signed my jar file. I have run jarsigner -verify on the jar file and everything looks in order (but I am not sure what I am looking for):
jarsigner -verify -verbose -keystore garageMonitor.jks ../GarageMonitorFinder.jar
s k 1561 Fri Oct 09 18:19:48 UTC 2015 META-INF/MANIFEST.MF
1425 Fri Oct 09 18:19:50 UTC 2015 META-INF/8D95B904.SF
8149 Fri Oct 09 18:19:50 UTC 2015 META-INF/8D95B904.RSA
0 Fri Oct 09 14:13:14 UTC 2015 META-INF/
0 Fri Oct 09 14:13:14 UTC 2015 com/
0 Fri Oct 09 14:13:14 UTC 2015 com/thompco/
0 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/
smk 107 Fri Oct 09 14:13:12 UTC 2015 META-INF/INDEX.LIST
smk 1128 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitor.class
smk 2320 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorBroadcastClient.class
smk 3631 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorFinder.class
smk 903 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorGui$1.class
smk 903 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorGui$2.class
smk 903 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorGui$3.class
smk 822 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorGui$4$1.class
smk 954 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorGui$4.class
smk 8192 Fri Oct 09 14:13:14 UTC 2015 com/thompco/garagemonitor/GarageMonitorGui.class
s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity scope
jar verified.
When I try to run the jnlp file, I still get the aforementioned error. Is there any way to trouble-shoot this?
Is there anyway to trouble-shoot/debug this?
OK, after pulling the remainder of my hair out, I stumbled on this thread. Turns out you:
go to your java control panel and settings... uncheck 'Keep temporary
internet files on my computer'. Apply changes and try again your .jnlp
it works! Well it did. Once.
I subsequently found this EXTREMELY useful JNLP debugger from Andrew Thompson (no relation) called JaNeLa. The website it was originally hosted is down, but AlBundy (and we thought he was just a shoe salesman) put it on github here
Turns out it is extremely easy to use: Just run the jar and point it at the URL or file (URL is better.)
For me, after moving to Java 8, I saw this same error. The solution for me was to add:
Permissions: all-permissions
to the jar manifest. For more information, see this oracle blog and info on the Permissions Attribute. (It seems as if Permissions attribute was needed with Java 7, but it didn't become an issue for me until I started using Java 8.)
First I want to say I am beginner in Java / Web development (but with great experience in programming and analysis). I search several surveys in several locations, not finding a solution to the problem that I think is configuration.
The story:
I implemented an Applet that uses javax.smartcardio for the ATR, this works fine without any problems! This applet must "transmit" the collected information to a web page that uses javascript (inside the script of this page), I opted to pass the information in json format and chose Gson for this... Running the applet inside the IDE this works fine!!! Running inside the browser (local IIS 7.5 server) this not work, showme a error: "Uncaught Error: java.lang.InvocationTargetException".
In first time I saw that the IIS log showed the following line:
2014-01-14 02:42:35 127.0.0.1 GET /com/google/gson/Gson.class - 80 - 127.0.0.1 Mozilla/4.0+(Windows+7+6.1)+Java/1.7.0_45 404 0 2 2
Looking at the contents of the JAR file I could see that the missing gson jar files...
I found that should put the files into WEB-INF \ lib directory of the project, it did not exist and Deployment Assembly also not too ... To fix this, I changed Project Facet (add Dynamic Web Module).
Now there is a folder: WebContent \ WEB-INF \ lib
I copied and pasted the three files from the explorer windows Gson ...
I added the files in deplyment Assembly and now they are in the exported JAR file but the same error keeps happening.
Note: There NOT is a security problem, the applet is signed, after removing gson functions and my method return the ATR code (string) directly the applet works fine.
Any step by step tutorial to "install" for it???
Thanks in advance!
Screen images:
RESUMING
The applet works fine, all functions work, except the function using GSON... In my local server (IIS 7.5) I create a site, and inside this site I put the files: index.html ; MyApplet.jar ; \scrits\Myscript.js Inside de MyApplet.jar file exists many files .class ; .classpath ; project and two folders (META-INF and WebContent with WEB-INF\lib and GSON jar files, three). The problem is: On execute the function using GSON it raise a error, in IIS log I see 404 for /com/google/gson/Gson.class
Applet Jar Content
>C:\inetpub\wwwroot\Sistemas\BryDiscover>"C:\Program Files\Java\jdk1.7.0_45\bin\jar.exe" -
>tvf Bry.Discover.jar
>>"1636 Wed Jan 15 15:33:10 BRST 2014 META-INF/MANIFEST.MF"
>>"1841 Wed Jan 15 15:33:10 BRST 2014 META-INF/PABLOERN.SF"
>>"1207 Wed Jan 15 15:33:10 BRST 2014 META-INF/PABLOERN.DSA"
>>>"415 Tue Jan 14 14:24:56 BRST 2014 .classpath"
>>"1742 Tue Jan 14 00:39:04 BRST 2014 SmartCardInfoList.class"
>>"1418 Tue Jan 14 00:39:04 BRST 2014 SmartCardInfo.class"
>>>"925 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$1.class"
>>>"927 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$2.class"
>>>"921 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$3.class"
>>>"917 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$4.class"
>>>"923 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$5.class"
>>>"917 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$6.class"
>>"1027 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$7.class"
>>"1419 Wed Jan 15 15:32:28 BRST 2014 BryDiscover$8.class"
>>"8905 Wed Jan 15 15:32:28 BRST 2014 BryDiscover.class"
>>"1045 Tue Jan 14 00:35:40 BRST 2014 .project"
>>>>"39 Tue Jan 14 00:35:38 BRST 2014 WebContent/META-INF/MANIFEST.MF"
"249351 Tue Jan 14 00:37:22 BRST 2014 WebContent/WEB-INF/lib/gson-2.2.4-javadoc.jar"
"127564 Tue Jan 14 00:37:22 BRST 2014 WebContent/WEB-INF/lib/gson-2.2.4-sources.jar"
"190418 Tue Jan 14 00:37:22 BRST 2014 WebContent/WEB-INF/lib/gson-2.2.4.jar"
WebContent \ WEB-INF \ lib
Try fetching your applet back from there, using a direct fetch in the browser address bar, to discover a 'not permitted' error (I think they are response codes in the 500 range).
If you cannot retrieve it by direct fetch, the Java Plug-In also cannot access it.
The applet needs to be moved to a place outside the WEB-INF directory structure that is accessible to the browser/plug-in.
Output of Jar command
..
190418 Tue Jan 14 00:37:22 BRST 2014 WebContent/WEB-INF/lib/gson-2.2.4.jar
The standard class-loaders are not designed to work with a 'Jar within a Jar'. It will be necessary to do either of:
Extract the Jar and add the content to the main Jar.
Separately list the gson-2.2.4.jar Jar in the archive attribute of the applet element (and not have it inside another Jar).
I'm interested in finding out how long each step within a job is taking.
Example: one of my jobs performs csv checkout, run ant build, publish javadocs, archives artifacts, run unit tests, etc. Is there a way to find out how long each took?
I've already added timestamps to the build.xml being used, but now I need to find out the duration (or timestamp) of the other job tasks.
Any help would be appreciated.
EDIT after comment :
Try PostbuildPlugin, see usage examples here.
You may start your ant scripts with ProfileLogger, available with Ant >= 1.8.x :
ant -logger org.apache.tools.ant.listener.ProfileLogger ...
The output looks like that (taken from ant manual) :
Buildfile: ...\build.xml
Target aTarget: started Thu Jan 22 09:01:00 CET 2009
echo: started Thu Jan 22 09:01:00 CET 2009
[echo] echo-task
echo: finished Thu Jan 22 09:01:00 CET 2009 (250ms)
zip: started Thu Jan 22 09:01:00 CET 2009
[zip] Building zip: ...\my.zip
zip: finished Thu Jan 22 09:01:01 CET 2009 (1313ms)
Target aTarget: finished Thu Jan 22 09:01:01 CET 2009 (1719ms)
Target anotherTarget: started Thu Jan 22 09:01:01 CET 2009
echo: started Thu Jan 22 09:01:01 CET 2009
[echo] another-echo-task
echo: finished Thu Jan 22 09:01:01 CET 2009 (0ms)
Target anotherTarget: finished Thu Jan 22 09:01:01 CET 2009 (0ms)
BUILD SUCCESSFUL
Total time: 2 seconds
Other options :
Antcontrib PerformanceListener
Antstatistics Logger
I need to be certain that jce is available even in JRE environments out of the box. After furious googling I only managed to verify that jce comes bundled with the JDK after Java 1.4. Does the jce come bundled with the plain JRE download as well?
Could you point out where you found the information, so I can verify for myself and know what I missed?
yes, the jce is included in all versions of java these days, relevant announcement.
Have you had a look at $JRE_HOME/lib/jce.jar?
~$ jar tvf jce.jar
6399 Thu Jul 27 16:03:42 CEST 2006 META-INF/MANIFEST.MF
6305 Thu Jul 27 16:03:42 CEST 2006 META-INF/JCE_RSA.SF
2015 Thu Jul 27 16:03:42 CEST 2006 META-INF/JCE_RSA.RSA
0 Thu Jul 27 16:03:26 CEST 2006 META-INF/
0 Thu Jul 27 16:03:24 CEST 2006 javax/
0 Thu Jul 27 16:03:24 CEST 2006 javax/crypto/
0 Thu Jul 27 16:03:24 CEST 2006 javax/crypto/interfaces/
210 Thu Jul 27 16:03:24 CEST 2006 javax/crypto/interfaces/DHKey.class
330 Thu Jul 27 16:03:24 CEST 2006 javax/crypto/interfaces/DHPublicKey.class
...etc
Note that the unlimited strength crypto policy files is (still) a separate download.
Cheers,
As mentioned, the JCE does come with all versions of Java.
However, if you wish to implement certain key sizes, be aware that you will need the Java Unlimited Strength Policy files. This is due to US laws on Key sizes.