I am trying to deploy R Shiny App as an Windows Desktop App. So far I have used the framework described at http://blog.analytixware.com/2014/03/packaging-your-shiny-app-as-windows.html and managed to make it work with the help of stackoverflow users (question name "R Shiny as Windows Desktop App Creates Text File With Warning").
An update to this framework has been developed and it has several advantages over the previous one, such as not relying on Google Chrome browser etc. and it is described here: http://oddhypothesis.blogspot.com/2016/04/desktop-deployr.html
All files can be found in the GitHub account of framework creator (link is presented in the description)
I have adjusted the following:
app.R
require(shinyjs,quietly = TRUE,warn.conflicts=FALSE)
require(markdown,quietly = TRUE,warn.conflicts=FALSE)
require(scales,quietly = TRUE,warn.conflicts=FALSE)
require(DT,quietly = TRUE,warn.conflicts=FALSE)
runApp("./app/shiny/", launch.browser=TRUE,quiet=TRUE)
packages.txt
Added the names of the packages I am using
# Primary package dependencies for the application that are loaded during
# startup.
#
# If not available, they will be installed into app/library. Custom source
# packages need to be installed manually.
# bare miniminum: configurations are stored in json format
jsonlite
# if deploying shiny based applications:
shiny
shinyjs
markdown
scales
DT
App does launch, it works. However a new folder is created called log with file error.log, which includes the following:
library paths:
... C:/Users/VoronecI/Desktop/New folder (2)/app/library
... C:/Users/VoronecI/Desktop/New folder (2)/dist/R-Portable/App/R-Portable/library
working path:
... C:/Users/VoronecI/Desktop/New folder (2)
Loading required package: methods
ensuring packages: jsonlite, shiny, shinyjs, markdown, scales, DT
Attaching package: 'shiny'
The following object is masked from 'package:jsonlite':
validate
Attaching package: 'shinyjs'
The following object is masked from 'package:shiny':
runExample
The following objects are masked from 'package:methods':
removeClass, show
Attaching package: 'DT'
The following objects are masked from 'package:shiny':
dataTableOutput, renderDataTable
Is there a way to prevent this logging of the unmeaningful error?
The reason why I want to get rid of it is because I further use Inno Setup Compiler to create .exe and this is not working when I have a log file updating each time I run the app.
As you can see in this file (line 66) https://github.com/wleepang/DesktopDeployR/blob/7c81e72c5beb29bf84ca65fd1d5bb5486caec51a/dist/script/wsf/js/run.js
The command is run as
var strCommand = [Rexe, Ropts, RScriptFile, "1>", Outfile, "2>&1"].join(" ");
which redirects command line outputs (that normally directly print to the screen) to the Outfile. You can change this line to
var strCommand = [Rexe, Ropts, RScriptFile].join(" ");
which will disable the logging. This might have other implications though (you might see a command window for example, I am not too sure but test it out).
Alternatively, you might be able to change this file https://github.com/wleepang/DesktopDeployR/blob/7c81e72c5beb29bf84ca65fd1d5bb5486caec51a/app/config.cfg (line 27) and set
- use_userprofile: true
(you need to uncomment this line, it is currently inside a block comment). This will make sure the log file goes into the user profile folder, and that might also solve your problem.
Ivona, I just finished developing the RInno package which also uses Inno Setup and the DesktopDeployR project to install local Shiny apps, and it will log errors without a problem.
To get started:
install.packages("RInno")
require(RInno)
RInno::install_inno()
Then you just need to call two functions to create an installation framework:
create_app(app_name = "myapp", app_dir = "path/to/myapp")
compile_iss()
If you are interested in other features, check out FI Labs - RInno. I'd be interested to know if turning off the error logging feature is something you would like to add ;)
Related
My app has already been signed and notarized successfully, but I got this error while trying to launch the app:
"jna7223640233751603426.tmp" cannot be opened because the developer cannot be verified
Does anybody have the solution for this?
How can I fix this problem? Can I block the file created while launching the app or make it valid for the Gatekeeper?
JNA releases have small precompiled binary JARs for each of its supported operating system/architecture combinations. These are not signed, although the source code is available if you wish to build and sign them yourself.
From a conversation on the JNA mailing list:
MacOS does not allow code created at runtime (which is typical malware behaviour), and that extracting a library at runtime looks like that code was created because it’s not visible outside the jar file in which it came.
A solution listed in that thread is:
by pre-extracting the library and bundling it as part of the installer.
In addition to this, you'll need to configure your application to tell JNA not to extract its own library but to use the one which you have signed and extracted as part of your installer. Source code from the above email thread:
boolean sandboxed = System.getenv("APP_SANDBOX_CONTAINER_ID") != null;
// Some 3rd party apps install to the system and can cause crashes
System.setProperty("jna.nosys", "true");
if(sandboxed) {
// Don't unpack the libraries
System.setProperty("jna.nounpack", "true");
// Tell JNA where the native libraries are
System.setProperty("jna.boot.library.path", "<path to native libs>");
}
I am developing a Biometric module using WBF. I am using the code given at Winbio CaptureSampleImage to get image data which is converted to a .bmp file and saved. I created a DLL file containing all the code related to my work with WBF. I am using this DLL in a Java Spring Boot Application using JNI. The jar created by this is run via a .vbs file as given below.
Set shellObj = CreateObject("Shell.Application")
shellObj.ShellExecute "C:\Program Files\Java\jre1.8.0_192\bin\java.exe", "-jar MyApp.jar", "", "runas", 0
"runas" is used to run jar as Administrator rights. "0" is used to set it invisible.
I have previously used the DLL in a Jar running as a service using WINSW. For this I included WinBio AcquireFocus after creating a session as mentioned in WinBio AcquireFocus and Winbio CaptureSampleImage and it works perfectly fine.
Now I have two scenerios.
1) I use the code provided in Winbio CaptureSampleImage. This approach gets stuck when following is called.
hr = WinBioCaptureSample(
sessionHandle,
WINBIO_NO_PURPOSE_AVAILABLE,
WINBIO_DATA_FLAG_RAW,
&unitId,
&sample,
&sampleSize,
&rejectDetail
);
that is no output is returned.
2) I use WinBio AcquireFocus like I did with my service.
This prompts error:
Code : 0x80070005 (Access Denied).
Common HRESULT values are given HERE. This is probably because AcquireFocus can not be used in Application such as mine.
I've created a "*.jar" file with Intellij IDEA and added to IBM Notes Domino 9 with Code -- Jars -- Import Jar.
I can see my packages in classes which stored in "Code -- Java") but i have an error when i try to use my jar in xpages code:
I have a simple code on my test xpage:
importPackage(com.ibm.ibateam.sources);
var area = new Area("first");
getComponent("label1").setValue(area.getUnid());
but this code throws exception:
Script interpreter error, line=2, col=16: [ReferenceError] 'Area' not found
1: importPackage(com.ibm.ibateam.sources);
-> 2: var area = new Area("first");
3: getComponent("label1").setValue(area.getUnid());
I've tried everything with Java Build Path but nothing works.
I also tried use information from this link:
http://www.xpagetips.com/2012/06/extending-your-xpages-applications-with.html
but move to "WEB-INF/lib/..." didn't help
I know I can add my jar to "...Notes\jvm\lib\ext)" or to eclipse plugins but I don't like this solution because I want to store my jar in notes database.
I am trying to use IM4J (a Java wrapper for ImageMagick) to create thumbnails of JPEGs and it is my first experience (ever) with both libraries. Please note that this is a hard requirement handed to me by my tech lead (so please don't suggest to use anything other than an IM4J/ImageMagick) solution - my hands are tied on the technology choice here!
I am getting a FileNotFoundException on the and convert command which tells me I don't have one of these libraries (or both) setup correctly.
On my computer, here is my directory structure:
C:/
myApp/
images/ --> where all of my JPEGs are
thumbnails/ --> where I want ImageMagick to send the converted thumbnails to
imageMagickHome/ --> Where I downloaded the DLL to
ImageMagick-6.7.6-1-Q16-windows-dll.exe
...
In my Java project, I make sure that the IM4J JAR (im4java-1.2.0.jar) is on the classpath at runtime. Although I am required to use the 1.2.0 version of IM4J, I have the liberty to use any version of ImageMagick that I want. I simply chose this version because it seemed like the most current/stable version for my Windows 7 (32-bit) machine. If I should use a different version, please send me a link to it from the ImageMagick downloads page in your answer!
As for ImageMagick, I just downloaded that EXE from here and placed it in the folder mentioned above - I didn't do any installation, wizard, MSI, environment variable configuration, etc.
Then, in my Java code:
// In my driver...
File currentFile = new File("C:/myApp/images/test.jpg"); --> exists and is sitting at this location
File thumbFile = new File("C:/myApp/thumbnails/test-thumb.jpg"); --> doesnt exist yet! (destination file)
Thumbnailer myThumbnailer = new Thumbnailer();
myThumbnailer.generateThumbnail(currentFile, thumbFile);
// Then the Thumbnailer:
public class Thumbnailer
{
// ... omitted for brevity
public void generateThumbnail(File originalFile, File thumbnailFile)
{
// Reads appConfig.xml from classpath, validates it against a schema,
// and reads the contents of an element called <imPath> into this
// method's return value. See below
String imPath = getIMPathFromAppConfigFile();
org.im4java.core.IMOperation op = new Operation();
op.colorspace(this.colorSpace);
op.addImage(originalFile.getAbsolutePath());
op.flatten();
op.addImage(thumbnailFile.getAbsolutePath());
ConvertCmd cmd = new ConvertCmd();
cmd.setSearchPath(imPath);
// This next line is what throws the FileNotFoundException
cmd.run(op);
}
}
The section of my appConfig.xml file that contains the imPath:
<imPath>C:/myApp/imageMagickHome</imPath>
Please note - if this appConfig.xml is not well-formed, our schema validator will catch it. Since we are not getting schema validation errors, we can rule this out as a culprit. However, notice my file path delimiters; they are all forward slashes. I did this because I was told that, on Windows systems, the forward slash is treated the same as a *nix backslash, in reference to file paths. Believe it or not, we are developing on Windows
machines, but deploying to linux servers, so this was my solution (again, not my call!).
IM4J even acknowledges that Windows users can have trouble sometimes and explains in this article that Windows developers might have to set an IM4JAVA_TOOLPATH env var to get this library to work. I tried this suggestion, created a new System-wide environmental variable of the same name and set its value to C:\myApp\imageMagickHome. Still no difference. But notice here I am using backslashes. This is because this env var is local to my machine, whereas the appConfig.xml is a config descriptor that gets deployed to the linux servers.
From what I can tell, the culprit is probably one (or more) of the following:
I didn't "install" the ImageMagick EXE correctly and should have used an installer/MSI; or I need to add some other environmental variables for ImageMagick (not IM4J) itself
Perhaps I still don't have IM4J configured correctly and need to add more environmental variables
Could be the Windows/*nix "/" vs. "" issue from my appConfig.xml file as mentioned above
I'm also perplexed as to why I'm getting a FileNotFoundException on a file named "convert":
java.io.FileNotFoundException: convert
I assume this is a batch/shell file living somewhere inside the IM4J jar (since the only thing I downloaded for ImageMagick was the EXE). However, if I extract the IM4J jar I only see classes inside of it. I see "script generator" classes, so I assume these kick off before my cmd.run(op) call and create the convert file, and maybe that's what I'm missing (perhaps I need to manually kick off one of these generators, like CmdScriptGenerator prior to executing my Thumbnailer methods. . Or, maybe my download is incomplete.
Either way, I'm just not versed enough with either library to know where to start.
Thanks for any help with this.
Run the 'ImageMagick-6.7.6-1-Q16-windows-dll.exe' installer first to install the imagemagick libraries. Then make sure your environment path includes the location of the installed binaries ('convert.exe', 'mogrify.exe', etc)
Make sure u have Set the environment-variable IM4JAVA_TOOLPATH.
In a web-app I'm writing, the user is supposed to enter the path in the Perforce repository for the node they're entering. The application is supposed to validate that the entered directory exists in the repo.
I've got the P4Package (p4.jar) lib, and I'm configuring it correctly enough that it works for almost everything, EXCEPT this directory validation. I'm creating a DirEntry (from the p4.jar) using a configured Env and a path, but when I call DirEntry.sync(), it issues an incorrect command. Where I want it to issue the command:
p4 [config info] dirs directory_argument <-- using the dirs command to validate a dir
Instead, it issues:
p4 [config info] dirs directory_argument%1 <-- note extraneous %1
Which always fails, since none of the directories have a %1 at the end of them.
Any help? Is there a different way to check that a directory exists using this package?
Sounds like the sync command has a bug in relation to dir entries and the command. My suggestion would be to just roll the command yourself, using the perforce command line as that has to be set up anyway in order to use the java library.
Process p = Runtime.getRuntime().exec("p4 dirs " + directory_argument);
BufferedReader stdOut = new BufferedReader(new InputReader(p.InputStream()));
//Read the output of the command and process appropriately after this
I would try another library, P4Java, instead:
http://tek42.com/p4java
P4Java is much newer and I've found works much better than the P4Package. It is used in the Hudson project and I've seen it in the Fisheye source, though, I'm not sure if they are using it or not.
So, the code I was using did have a bug requiring me to make a change and check the code into my repository.
However, since then, Perforce has come up with their own Java wrapper for the P4 client which works much better. I'd give that one a shot.