What URL used to unblock Java Security for local JNLP - java

For the life of me, I can't figure out what to give Java Security as a "URL" to unblock an application launched by a JNLP file in my own file directory.
When I use my browser to call the JNLP file from a Java EE application deployed to my glassfish server, I have a "URL" so I can unblock that.
But for testing I'd like to be able to also just double click the JNLP file in my local PC directory to launch the app.
It can't be that difficult. Double clicking the JNLP file does in fact begin to launch the app. Just Java blocks it. And I just can't figure out how to unblock that kind of call ... and can't find any reference to that simple a need.

Have you tried:
file:///path/to/application.jnlp
?

Related

Can't locate the file on local file system from Servlet

I wrote a RESTful web service using Jersey library and in order to respond to the request I have to read a text file in local file system. C:\data.txt. The servlet works fine when I run it with tomcat on my own laptop.
But when I deploy the war on another machine running windows server OS and place the data.txt again at C:\data.txt. The servlet can't locate the file correctly. Anyone has idea about why is this?
Thanks a lot!
Check whether the Tomcat server process has read-access rights to file C:\data.txt. Check which user is used for running the tomcat process and check the corresponding user file permissions.
I also suspect it is a security error. Applications are usually restricted to reading and writing within their own directory under $TOMCAT_HOME/webapps. If this is the case, you need to change $TOMCAT_HOME/conf/catalina.policy to allow you to access other directories.
If you don't need to write to the file, consider moving its location inside of the classpath by putting in into $TOMCAT_HOME/lib instead.
I think this approach is also better in regards to being cross-platform.

Open my Java application on local website (HTML)

I've finished my project in Eclipse en build the Java.jar file, it runs fine when i click it on my browser but now i want it on a local website so for examle c:/user..... so it will run in the browser but how can i do that ?
You can not just simply run a java application with a web browser only from your hard drive...Unless it is an applet like the previous owner said.
In general you will need to setup some kind of application server (tomcat, jboss,...)
is it an application or an applet??.
Unless the jar file also contains an applet class, there's no way to get it to work in a browser as is.
Check this out this Applet Class.
You also need
TomCat or Glassfish

Where is the application logic in a Java Web Start deployment?

Where does the application logic run in a Java Web Start deployment? I want to understand the intellectual property security risk of Java Web Start. On the client end does it merely start the application on a server and then proceed to process pixels (GUI objects) and mouse clicks at the client? or is my application logic executing at the client?
Implicit in my question is the assumption that I place no value on any aspects of the design that can be inferred by looking at the GUI buttons, text output and by being an experienced user of the application. The value is in the code and logic.
Java Web Start downloads code to the client, and executes it there. The application logic will execute at the client.
Basically JWS keeps local .jar in sync with that on a server to execute an application in local mode. Read about JNLP here.
So the risk for reverse engineering is the same as with any jar packet Java app.
Basically Java Web Start downloads the latest jars (Application Logic) from the server when u launch it with the help of JNLP. and then it installs this application in temporary internet files or cache.
Your whole application logic(cache) exists in cache at client side. and then your jnlp file use them (jars)

Access Files Remotely on Windows using a Windows Service

I have a Windows service that executes a .bat file. This .bat file executes some Sava code that reads some files' information. The files I need to access are not in the same machine that the service is running. So I should access them using a mapping like G:\.
Even if the files exist on G:\ when I run the service, File exists() and File canRead() always return false.
If I execute the .bat manually, everything works great, but I need to execute it using a service.
The service is running with a user that has permissions to read all files on this G:\ mapping.
Does anyone have a clue as to what can be wrong? Why can't I access these remote files, when running as a Windows service?
The OS in question is Windows XP.
The problem usually is that the user running the service does not have the same G: drive as well as the same access.
I suggest you log in as the user running the service and see what that user sees.
Drive mappings aren't shared between sessions, and service sessions don't get drive mappings reestablished automatically the way interactive sessions do. You should put a net use command in the batch file to explicitly establish the drive mapping in the service session.

Java standalone app with dynamic configuration via server over HTTP

i am writing a standalone java app. the app's properties should be configurable from a webpage deployed with the app. how do i achieve this ?
Thanks in advance
note: the app has an embedded HTTP client/server module. it should only run from command prompt
I don't think that's a good idea. Webpage forms are designed to work with a server, not with a standalone client app. You could have the app run its own web server, but that would mean the app has to be running for the configuration page to work, and it's also a rather contrived setup just to do some configuration.
It might be possible for the webpage to contain JavaScript that writes to a local file - I don't know enough about the JavaScript security model to say.
But why not have the configuration dialog as part of the app's GUI? That's the normal and expected behaviour - you'd need a pretty compelling reason to deviate from it.
JMX might be the answer that you're looking for. If you expose all of your configurable properties through MBeans, then adding a web page on top of that exposing these properties is just configuration.
You can launch a standalone Java app using JNLP files (Java WebStart). If you want the user to be able to configure the application before its launched, you can have the JNLP file dynamically generated, then pass properties as environment variables through the JNLP file.
You can configure your standalone Java app to read configurable properties from a properties file (say conf.properties) on the server.
You may have a UI webpage (html/jsp) with all the field to be configured. When the page is submitted a JSP/Servlet may write/update the contents of conf.properties on the server.
UPDATE: The above solution will work assuming only an admin user wants to update the properties file.
In case anybody should be able to update it, then concurrency issue has to be taken into account.
In that scenario, you have to implement a mechanism similar to how weblogic10 updates config.xml using Admin Console.
i.e. You will have 2 conf.properties files confA & confB (initially in sync). The standalone app will always read from confB. The UI will have 2 buttons say Lock & Release configurations. When an edit is made (locked & released), it will be written to confA and at the same time changes of confA has to be replicated to confB.

Categories

Resources