Advanced Installer Working in appdata - java

I have a simple reporting java application that is using jre archive,h2database and jasper repor.
The database file location is : appdir\files\db\tbs.mv.db
The Jasper file Jrxml file location is : appdir\files\report.jrxml
Basically i want to move the DB file to %appdata% folder so that it does not require administrator access to write to the h2database file.
In Advanced Installer Files and Folder>>Application Data
I added the folder files . Database connection working fine but not the jasper jrxml file.
Anyone can instruct me in details that how i can make my application work in %appdata% with Advanced Installer?

I was forgot catch exception. The jrxml file was not found.
Problem is solved!

Related

Where to put an excel file in a dynamic web project so that I can write and read it.(use it as DB)

I have a dynamic web project where I have login and register user and I am using POI to read and write the details in an excel file.
I want to deploy this project as WAR file on tomcat.
But the issue here is Tomcat is not able to find the excel file's path.
So where should I place the excel file.
Right approach would be to
Make a directory on your OS outside of the tomcat.
Write a startup servlet which will check if the directory already exists.
If the directory exists, go ahead and create the excel file into that directory, instead of keeping an already build file, that way you make sure that the excel file is not tampered by any developer accidentally and is only constructed by the application.

How to change the read/write permission of SQLite database on windows?

I created a software using NetBeans and SQLite database. When I clean and build, the executable jar file and database work fine. It can read and write data from the database.
Then I created .exe file using "install creator" and after installing the software, the same dist folder is created in Program files on my Windows PC. When I run the executable jar file from that dist folder, it can only read the database, but can't write. I get this message
java.sql.SQLException:attempt to write a readonly database
Can anyone please help me solve this problem? Thanks in advance.
check this
The problem, as it turns out, is that the PDO SQLite driver requires that if you are going to do a write operation (INSERT,UPDATE,DELETE,DROP, etc), then the folder the database resides in must have write permissions, as well as the actual database file.
I found this information in a comment at the very bottom of the PDO SQLite driver manual page.
You should write the user specific data to the Application Data folder of current user.
You can get the ROAMING directory from
String path = System.getenv("APPDATA");
Or if you want to make it platform independent you can use getProperty which will give you users home directory and then you can write to specific directory:
String path = System.getProperty("user.home");
You can form the sqlite on path like
String sqliteUrl = "jdbc:sqlite:"+path+"sample.db";
Use this code line:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\databasefile.db"
I can say this is the proper way of creating DB in application folder on to the drive like C:\ without permission
Use this code line:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Yourfile.db"
I can say this is the proper way of crating DB without permission on to the drive like C:\

default directory of domino designer project

I want to access directory of domino designer project by java agent to make report from database ,I want to save this report file in agent directory I try this code
File file = new File("Local/file.txt");
but it doesn't work.Can any one help me please?
Domino Designer for Eclipse creates the Local directory for each project in a location you can figure out, but it probably is NOT the place to create a report file. The Local directory is in the Notes/Data/Workspace/<servername>/<dbpath>/Local. You would be better to use a directory below the Notes/Data directory which you can find using NotesSession.getEnviromentString("Directory", true)

How to refer a file system in Cloudbess?

I'm new to Cloudbees. I just opened an account and trying to upload a .JAR file which basically downloads a file to the location mentioned by user (through java command line arguments). So far I have run the .JAR in my local. So far, I was referring to my local file system to save the file. If I deploy my .JAR file to Cloudbees SDK, where can I save the downloaded file (and then process it).
NOTE: I know this is not a new requirement in java if we deploy the jar in UNIX/WINDOWS OS where we can refer the file system w.r.t to home directory.
Edit#1:
I've seen couple of discussions about the same topic.
link#1
link#2
Everywhere they are talking about the ephemeral (temporary) file system which we can access through System.getProperty("java.io.tempDir"). But I'm getting null when I access java.io.tempDir. Did anyone manage to save files temporarily using this tempDir?
You can upload a jar with the java stack specifying the class and classpath (http://developer.cloudbees.com/bin/view/RUN/Java+Container)
Our filesystem however is not persistent, so if you are talking about saving a file from within your application, you could save it in this path
System.getProperty("java.io.tmpdir")
but it will be gone when your application hibernates, scales-up/down or is redeployed.
If you want a persistent way to store file/images, you can use AmazonS3 from your cloudbees application: uploading your files there will ensure their persistence.
You can find an example of how to do that in this clickstart:
http://developer-blog.cloudbees.com/search?q=amazon+s3
More information here: https://wiki.cloudbees.com/bin/view/RUN/File+system+access

Java applet error

I am doing a project on applets. I designed the applet using netbeans. After building the project in netbeans, I took the directory "classes" and a .html file from the "build" directory and moved it to another new directory. This .html file includes the applet. The .html file displays the applet correctly, when it is viewed from my desktop.
I uploaded the "classes" folder and the .html file to my free server (host4ufree.com) using FileZilla. If I try to view the webpage online, I get the following error instead of the applet getting displayed:
java.lang.ClassFormatError: Extra bytes at the end of class file
I am using JDk 1.6.0 update 18, and uploaded the file using FileZilla both ASCII and binary format manner. Yet, I am not able to solve the error problem. Does anybody know the solution to this? Is there something wrong in the manner in which I'm trying to add the applet to my webpage?
The question is quite unclear :S Anyway...
I uploaded the "classes" folder and the .html file to my free server
(host4ufree.com) using FileZilla.
If your applet contains more that one class I do not recommend upload the project classes folder itself but wrap your applet classes to jar file before delpoying it.
Report if that helped

Categories