I am trying to open my created .eml file with java in linux. Currently I am using the following command:
Desktop.getDesktop().open(emlFile);
I create the eml file as shown in this example.
This works for my windows system, but an error occurs in linux ubuntu 12.04.
EDIT: error message:
(process:19386): gnome-vfs-modules-WARNING **: Could not initialize inotify
java.io.IOException: Failed to show URI:file:/home/usr/workspace/programm/eml/mail.eml
at sun.awt.X11.XDesktopPeer.launch(Unknown Source)
at sun.awt.X11.XDesktopPeer.open(Unknown Source)
at java.awt.Desktop.open(Unknown Source)
I am happy for any help!
From the docs java.awt.Desktop.open(File)
Throws IOException - if the specified file has no associated
application or the associated application fails to be launched
Related
I'm working on Ubuntu and using Netbeans. My code is trying to connect to the libvirt host "qemu+ssh://IPaddress/system". The development environment and the service environment is different. The output-jar file I put on the service environment but apparently I hit below error when rebooting the service. I already added the jna-3.2.5.jar and the libvirt-0.5.1.jar on to the path folder of my service environment.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to
load library 'virt': libvirt.so: cannot open shared object file: No
such file or directory
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
at com.sun.jna.Native.loadLibrary(Native.java:375)
at com.sun.jna.Native.loadLibrary(Native.java:360)
at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
at org.libvirt.Library.<clinit>(Unknown Source)
at org.libvirt.Connect.<init>(Unknown Source)
What else I have missed?
thanks for the response.
Apparently, I have to install libvirt package on to my service environment, and the error will be gone. I hope it will help other's problem as well.
I have a c# DLL, i convert that dll from JNI4net to work with java. I am able to call the dll in java but when i create a jar file and trigger java function from oracle on button event. It throws exception.
Java code:
Bridge.setVerbose(true);
Bridge.setDebug(true);
Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("ECR.j4n.dll"));
ComECR test = new ComECR();
test.VFI_DoSetup();
ORACLE Exception :
java.lang.IllegalArgumentException: URI scheme is not "file"
at java.io.File.<init>(Unknown Source)
at net.sf.jni4net.CLRLoader.findDefaultDll(CLRLoader.java:54)
at net.sf.jni4net.Bridge.init(Bridge.java:31)
at com.ecr.test.Program.getProperty(Program.java:57)
at oracle.forms.handler.UICommon.onGet(Unknown Source)
at oracle.forms.engine.Runform.onGetHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
I have signed jar and also added the jar in class path and formsweb.cfg
need help on this
You have this very message error in SO: URI scheme is not "file"
From your error, I would try the below:
Bridge.setVerbose(true);
Bridge.setDebug(true);
Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("file:<fullpath>/ECR.j4n.dll"));
ComECR test = new ComECR();
test.VFI_DoSetup();
The fact that you're getting the error with Oracle only could mean Oracle doesn't work with same Path as Java alone. It isn't missing the jar file's path but the dll one's.
I was wondering if someone could help me find a good resource to help me fix this issue. I'm trying to create/save a batch file in the startups folder. Here's the general path: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\startup_PMA_popup_check.bat
I've read a lot of things saying that I should simply elevate the privileges of my java program.
I read that if I was to make my jar file a windows executable, then the rights of the program are automatically elevated to admin privileges.
What you're seeing below is my jar turned into an exe and run. The error I got was the same error as the one I got from running my jar. I no longer think that the problem is simply giving my program admin privilege.
I performed a test outside of my program by going to this path and attempting to move a file into the folder. Assuming I'd have no issue "since I am root already", I went ahead expecting to get no prompts. What I got was a popup saying that I needed to confirm that I was Admin & to confirm that I wanted to put the batch file in the folder.
My question is how should I make my java program issue this prompt to the user or something so my program can continue & not crash like shown below??:
Exception in thread "main" java.io.FileNotFoundException:
C:\ProgramData\Microsoft\Windows\Start
Menu\Programs\StartUp\startup_PMA_popup_check.bat (Access is denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.FileOutputStream.(Unknown Source)
at java.io.PrintWriter.(Unknown Source)
at java.io.PrintWriter.(Unknown Source)
at prioritymanagementassistant.Background.createBatchFile(Background.java:106)
at prioritymanagementassistant.Main.main(Main.java:930)
Thank You for your time,
I recently decided to use an official installer for my Java application.
The application installs its self in the appropriate folder under the Programs Files.
Inside the bin folder where the jar for my application sits, I have a h2.db file which contains a bunch of information that is read by the application.
When I try running the application in the installed location I get an exception:
org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.FileNotFoundException: C:\Program Files (x86)\Aurora Game Hub\bin\AuroraDB.lock.db (Access is denied)"; "C:/Program Files (x86)/Aurora Game Hub/bin/AuroraDB.lock.db" [90031-167]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convertIOException(DbException.java:315)
at org.h2.store.fs.FilePathDisk.newOutputStream(FilePathDisk.java:265)
at org.h2.store.fs.FileUtils.newOutputStream(FileUtils.java:223)
at org.h2.store.FileLock.save(FileLock.java:197)
at org.h2.store.FileLock.lockFile(FileLock.java:333)
at org.h2.store.FileLock.lock(FileLock.java:128)
at org.h2.engine.Database.open(Database.java:542)
at org.h2.engine.Database.openDatabase(Database.java:222)
at org.h2.engine.Database.<init>(Database.java:217)
at org.h2.engine.Engine.openSession(Engine.java:56)
at org.h2.engine.Engine.openSession(Engine.java:159)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:138)
at org.h2.engine.Engine.createSession(Engine.java:121)
at org.h2.engine.Engine.createSession(Engine.java:28)
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:305)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:110)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
at org.h2.Driver.connect(Driver.java:72)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at aurora.engine.V1.Logic.ASimpleDB.searchAprox(ASimpleDB.java:828)
at aurora.V1.core.GameSearch.searchGame(GameSearch.java:249)
at aurora.V1.core.GameSearch.run(GameSearch.java:346)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Program Files (x86)\Aurora Game Hub\bin\AuroraDB.lock.db (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.h2.store.fs.FilePathDisk.newOutputStream(FilePathDisk.java:257)
... 22 more
It works fine when its not in the Program Files location, as I would have noticed this while developing.
i'm thinking it has something to do with permissions and the lock file not able to be created or something. Is there a way to give/ask explicit permission to create the lock file or can I tell H2 to just not create the lock file?
We've thought about having the static database placed somewhere other then the install location, but since this has to run on Mac and PC and the way the installer is set up it would make things more complicated.
Any help would be very much appreciated.
It seems there are no access rights to write to this directory. You need to store the database file in a directory where you do have access rights.
For H2, if you use the database URL jdbc:h2:~/data/db, the database is stored relative to the current user home directory. Another alternative is to use an absolute path, for example jdbc:h2:c:/dir/to/db/file
This is caused by improved security in windows. You can write only when you have elevated privilages. For example if you start program as 'run as administrator', then it may able to write to Program Files area. Then it is not a good idea- see: Bypass Windows permission restrictions on program files folder
You should use folder pointed by 'ProgramData' variable. or good old user.home area
On Mac OS X, you can use the known subdirectories of user.home cited here.
Java Web Start with suitable permissions may be an alternative, although I haven't tried it.
Sorry for this question but I'm a newbie to Java. I tried searching for similar problems, and I did find some answers, but none worked in my case, so here it goes:
I'm trying to load a java applet on a web page. The applet is supposed to be loaded from a .jar file (UCFApplet.jar), but I cannot get it to load no matter what.
Here's the html for the applet:
<applet id="UCFApplet" height="200" width="200"
code="com.fujitsu.test.applet.UCFApplet"
archive="UCFApplet.jar">
</applet>
The jar file is on the server, on the same folder than the html file that is trying to load it. Inside the jar file there's a UCFApplet.class file on com/fujitsu/test/applet folder.
The error I'm getting on the Java console is the following:
Java Plug-in 1.6.0_29
Using JRE version 1.6.0_29-b11 Java HotSpot(TM) Client VM
User home directory = C:\Users\PTMAIAJ
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
load: class com.fujitsu.test.applet.UCFApplet not found.
java.lang.ClassNotFoundException: com.fujitsu.test.applet.UCFApplet
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: com.fujitsu.test.applet.UCFApplet
As you can see, I'm using jre 1.6.0_29 build 11, which, from what I get on the Oracle page, is the latest build. This happens on all browsers (IE 9, FF, Chrome).
I suspect it may have something to do with not being able to access the .jar file because if I change the html code to a dummy name such as archive="thisFileDoesNotExist.jar" it gives me the same error. But I don't really know what to put there in order to make it work.
Any idea about what I can be doing wrong ?
Thank you and best regards,
Joao Maia
Your descriptor seems to be correct, so try the following.
First check that browser can download the jar. Type the direct URL to jar file into your browser. For example if your html can be accessed by typing
http://localhost/myapp/mypage.html
type
http://localhost/myapp/UCFApplet.jar
If you can download the jar and it is identical to your jar continue.
Check the jar itself. Type in command line
jar vft UCFApplet.jar
and see output. You should be able to find your class:
/com/fujitsu/test/applet/UCFApplet.class
BTW do you know that applet tag is deprecated and is not supported by Opera and Chrome? To support all browsers you should use tag object
Try turning on tracing in the java control panel. It will then produce a log file in the following path that may help:
%USERPROFILE%\AppData\LocalLow\sun\java\Deployment\log
In my case I had an error which only appeared when I turned on tracing, and which presented as simply a "ClassNotFoundException":
java.util.zip.ZipException: duplicate entry: META-INF/LICENSE.txt
The applet loader was rejecting the jar because the zip file had a duplicate file entry. Strangely appletviewer.exe was able to load and run this jar fine.
For those of you running behind a corporate proxy. According Oracle ClassNotFoundException is "a common error that is seen if the proxy settings are not correct".
See: How do I configure proxy settings for Java?