I've coded small JavaFX Applet in Netbeans 6.8 IDE. Everything works fine if the applet runs on my computer. But when I put the applet (and edited JNLP files containing changed paths to server) into server, it doesn't load any data from an server text file. Paths are correct - i look at it many times - they are ok. It also doesn't load images with external urls. What is wrong?
Haven't seen your code so I'm going to make a guess. If your resource is not bundled in your JAR file and you are using file:// to access it, then you will need to sign your applet. On NetBeans, right click on project node -> properties -> application. Select self signed.
If you don't want to sign your applet, then access your resource as REST. Use the HttpRequest.
If it is on the client machine, consider using JNLP APIs like so.
FileOpenService fos = (FileOpenService)ServiceManager
.lookup(“javax.jnlp.FileOpenService”);
//Open dialog pops up
FileContent fc = fos.openFileDialog(null, null);
The best way to diagnose the problem is to open the Java Console and see if there are any exceptions. Run $JAVA_HOME/bin/ControlPanel -> Advanced -> Java Console -> Show Console
Related
This is for Window 7 and Window 10
We have requirement to generate jar inside c:program file only. Installer can easily install our jar into c:\\ProgramFile\\testapp. After that we have the requirement to download the zip file from third party server inside c:\\ProgramFile\\testappp and here we are getting the access denied.
After lot of research, we come to know, we can run our jar under administrator privileges using super-user-application-0.0.5.jar.
Now the problem is We are getting the "User account control popup" with message "Do you want to allow the following program to make changes to this computer"
We don't want this popup so anyone know how to bypass this popup?
The important code from super-user-application-0.0.5.jar is
Shell32X.SHELLEXECUTEINFO execInfo = new Shell32X.SHELLEXECUTEINFO()
execInfo.lpParameters = args
execInfo.lpDirectory = lpDirectory
execInfo.fMask = Shell32X.SEE_MASK_NOCLOSEPROCESS
execInfo.lpVerb = "runas"
boolean result = Shell32X.INSTANCE.ShellExecuteEx(execInfo)
execInfo.lpVerb = "runas" is actually opening the popup. Is there any way, just bypass the popup and further processing should be similar to the saying OK to the popup.
Any chance to java programatically provide admin rights to the testapp folder created inside c:\ProgramFile\testapp
I currently have a major problem with loading of CSS and images in JavaFX.
The goal is to make JavaFX load the images that are defined in the CSS file. I get this to work easily in the IDE and in the standalone execution. But once I try the the application as a applet and run it inside a browser context everything fails.
The CSS file is still load properly, but the image files remain blank. Sadly I can't find a way to make JavaFX log why the image loading is failing. All the images are located in subdirectories from the location of the CSS file and are accessed for example like this:
.button-gray {
-fx-border-image-source: url("button/buttongray.png");
}
The CSS file is located in the same package as the class that handles loading it and is load like this:
final URL css = Util.class.getResource("sheet.css");
if (css != null) {
parent.getStylesheets().add(css.toExternalForm());
}
I tried already placing the resources in the root directory and load it with Util.class.getClassLoader.getResource(...) and Thread.currentThread().getContextClassLoader.getResource(...). Both worked fine in case the application was executed as stand alone. Neither worked in case the application is launched from a webstart applet context.
But as I said. In all cases there is no indication that the CSS is not load. The styles defined in the stylesheet are applied properly with exception of the images.
I am running out of idea what the reason for this is. I package and publish the application using the gradle javafx plugin by shemnon.
Building environment:
Oracle Java 1.7b45 x64
Gradle 1.9
Anyone know how to fix this problem or has any idea how to debug it.
Sadly the logging facilities of JavaFX (even the CSS Logger) and the applet trace console give no indication what the problem is.
New Information!
The JNLP file is located here:
JNLP-File
How ever, this file is not the problem. The problems seems to be the generation of the binary css file that is part of the deployment process of JavaFX for webstart. In this binary file, for some yet unknown reason there is a reference to the CSS file inside by building environment. This causes the CSS loader to load the image files from the location on my building server. Something that does not work in my local computer. Builds I did on my local computer on the other hand work because the files are still at the location its looking for.
So now the problem seems to be limited to the binary css generation that stores a entirely wrong file reference.
1) Can you post the .jnlp file that you're using to deploy the app? An incorrect .jnlp can cause resource loading issues like this.
2) Give us the exact invocation of Thread.currentThread().getContextCLassLoader.getResource("") that you're using.
3) Report the contents of the .jar file, with the exact folder/path structure of the file(s) in the jar that you need to load. For example, 'My code is looking for example.png, it should be in the pics.jar file inside the folder com/mycompany/myimages', something like that.
WebStart takes some doing to get working, but I'd suspect the answer lies in there somewhere. If all else fails, I've found JaNeLa to be helpful in debugging web start deployment problems. http://pscode.org/janela/
Have you tried loading the css file with:
final String css = getClass.getResource("sheet.css").toExternalForm();
parent.getStylesheets.add(css); // taken that parent is the name for the Scene.
For the css:
-fx-border-image-source: url("../button/buttongray.png");
Using URL and Util.class is not something that is common to use for loading stylesheets afaik.
Maybe try NetBeans IDE 7.4. Personally i don't know Gradle.
I have a file on linux ubuntu server hosted with path name /home/kishor/project/detail/.
When I made a web app in window to upload and download file from specified location i used path "c:\kishor\projects\detail\" for saving in window.
For my surprise when i used window file path name in my server i am still able to get files and upload them, i.e, "c:\kishor\projects\detail\".
Can anyone explain why it is working (as window and linux both use different file path pattern).
I've seen this work too. What linux does is create a file whose name is literally c:\kishor\projects\detail\
If you say, you can "upload" files... perhaps there is now a new folder structure.
Some months ago i saw a similar thing: Under /home/webadmin was an new structure "/c:/Users/...."
I am trying to write a log file from an applet.
When running as a Java application, I am able to write to the files,
but when running as an applet, I get .\logs\test.log (The system cannot find the path specified).
How do I permit it to write to disk, while debugging using eclipse?
EDIT: is it because of the backslashes?
You should write whatever you want from applet in temp file, to create temp file Try this
. Also you get system temp folder in java and create your file there, Read this. #Yoni is right you have limited permissions when you are in applet.
I have an Java application for copying large amounts of data from users' workstations to a server. The java.io.File class is supposed to work with UNC paths very well and in fact it does but only when I run the app in standard execution model.
When the application is launched via Web Start I get a FileNotFoundException when trying to open a FileOutputStream with "The network path was not found" in message. Again everything works fine when I download the jar to the PC and lauch it from command line.
My app is signed and i define all-permissions in JNLP.
Edit: I have also discovered that when I map the UNC path to a drive letter it works too.
There is no solution to this. I ended up mounting the path as a named volume and using it trough the volume.