Opening a file from a java app (not applet)
My program can't find the text file I'm trying to open in my stand-alone java app. I am specifying it like this:
File filename = new File("myfile.txt");
FileReader = new FileReader(filename);
It is in the same directly as the class files. It won't find it when it's in a jar file either. I had a similar problem with an applet a lont time ago, but that turned out to be a security issue, which I assume normal apps don't have.
So, what's up with this?
If system become larger, there are duplicated files
can be found in different directories.
Using classpath may cause problem, if there are
duplicated file name.
If you are coding, you should know exact location of
the file to be opened.
"system become larger" - huh? You control the classpath on a per-app basis, not one huge monolithic classpath containing all jars/folders for all apps.
It's common, well-designed practice to use the classpath. It's bad practice to hard-code directory names and expect all deployments of the app to follow the same directory naming convention. I wouldn't want you to dictate to me where to put the file on my hard drive. I should be able to install it anywhere I want, and let it find it (via the classpath, in this instance).
Similar Messages
-
Opening a document from a Java app
I need to open a document from my Java app. It is a .rtf file and I would like it to open with the system associated application for rtf files. How should I do that?
I have tried to figure out the Runtime.exec(), but it doesn't do what I need. I have been able to open Notepad or WordPad (oh, yes, I am on a Win XT system) by specifying them in the exec function, but I can't find info on how to let the system choose the program.
Thanks for your help.
WayneTake a look at the JDIC project
https://jdic.dev.java.net/
In particular the org.jdesktop.jdic.filetypes.AssociationService class
https://jdic.dev.java.net/nonav/documentation/javadoc/0.9/index.html -
Open a file into a java app - HOW DO YOU DO IT!!
I have written an html/php editor - I want to set it up so that when you double click on a php file in windows it will open the file into my java ide.
I know this can be done - but how!!! There does not seem to be any info on the web about it - can anyone give me some pointers.
ThanksYeah - but the problem is: You can only set files to
open with a .exe file - if you go to the settings and
set the .php file to "open with" you have to select a
.exe file e.g. notepad.exe
However you can't create .exe files in java!!!! So how
do you do it?You have to spend $$$'s
However many /most converters don't work without the relevant updated JVM (but they are *.exe, kind of) -
Executing class files from a Java App dynamically
Hi!, Is there any way i can execute java .class files from my Java Application dynamically. I know that java uses Dynamic method Invocation. Is that true of class files generated using some other language compiled for the JVM.
In my case i would like to make a Web browser that interprets HTML and also java applets embeded in them. I would like to use the JRE of the platform execute the applets for me rather than writing the code for my Browser to interpret the class files.
Thanks in Advance.You just need a custom class loader to bring these applets into your JVM.
http://developer.java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/URLClassLoader/index.html
Then you can use the methods of java.lang.Class to create an instance of such a class. As soon as you have it, you can just treat it as a regular Applet and invoke init(), stop() etc. appropriately.
If you want to execute anything else than conventional Applets, you might consider reflection to find out about methods implemented:
http://java.sun.com/docs/books/tutorial/reflect/index.html -
Hello,
I want to open (with another application Android) a file from an Air application
navigateToURL( new URLRequest(myFile.url) );
the problem is that Android give me only Adobe Reader to open "myFile"
how Android proposes to all applications succeptibles to open "myFile" ?
openWithDefaultApplication() doesn't work on Android.
thanksI found in http://forums.adobe.com/thread/864113
-
Have downloaded Adobe Photoshop Elements 10 Editor from the Mac App Store onto my Mac Book Pro, set i photo preferences to Adobe PSE 10 editor, but when I try to open a file from my photo library, the following message appears: "could not complete your request because of a program error". What can I do to resolve this issue?
Hi..
Post your topic in the iPhoto community here. That way you can get feedback from iPhoto users.
This community is primairly for issues with the App Store. -
Hi,
I need some help.
Product=weblogic5.1.0
Revision=(Release Level)=
Problem Description=
I am doing cluster of weblogic server, I have no problem to set up the
cluster and to run servlet and EJB examples.
However, on my command line for startcluster I got a lot of message as
followed:
Fri Aug 18 11:31:44 EDT 2000:<E> <MulticastSocket> Multicast socket receive
error: java.lang.RuntimeException: I/O error opening JAR file from
file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
at weblogic.boot.ServerClassLoader.deploy(ServerClassLoader.java,
Compiled Code)
at
weblogic.cluster.AnnotatedServiceOffer.expandClassPath(AnnotatedServiceOffer
.java, Compiled Code)
at
weblogic.cluster.AnnotatedServiceOffer.readObject(AnnotatedServiceOffer.java
, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
jectInputStreamBase.java, Compiled Co
de)
at
weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
treamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
tStreamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
eamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
treamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readArrayList(WLObjectInput
StreamBase.java, Compiled Code)
at weblogic.cluster.StateDump.readObject(StateDump.java, Compiled
Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
jectInputStreamBase.java, Compiled Co
de)
at
weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
treamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
tStreamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
eamBase.java, Compiled Code)
at
weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
treamBase.java, Compiled Code)
at weblogic.cluster.TMSocket.execute(TMSocket.java, Compiled Code)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
The message freshed about every 20 seconds.
Another question, I used a iplanet web server as a proxy server with a
cluster of two weblogic servers pluged in, although I set
weblogic.properties to round-robin, however, when I run a fibonacci servlet,
it does not do the round-robin. It always go to one machine for a lot of
times. Any idea?
Thank you for your help.
Tom
May i presume that your cluster is configured on a shared file system?.
I have seen this problem only if you cluster is configured on different machines
and if the directory structure is not identical.
let us know..
Kumar
Cameron Purdy wrote:
> First, update to SP4 (or SP5 if it is out now). Second, follow the cluster
> instructions on setting up deployments for a cluster. The only
> implementation that I have used is the single shared location that all the
> servers load from.
>
> --
>
> Cameron Purdy
> http://www.tangosol.com
>
> "Tom Gan" <[email protected]> wrote in message
> news:[email protected]...
> > Hi,
> > I need some help.
> >
> > Product=weblogic5.1.0
> > Revision=(Release Level)=
> > Problem Description=
> > I am doing cluster of weblogic server, I have no problem to set up the
> > cluster and to run servlet and EJB examples.
> > However, on my command line for startcluster I got a lot of message as
> > followed:
> > Fri Aug 18 11:31:44 EDT 2000:<E> <MulticastSocket> Multicast socket
> receive
> > error: java.lang.RuntimeException: I/O error opening JAR file from
> > file:/D:/weblogic/mycluster/server86/tmp_deployments/ejbjar-17327.jar
> > java.util.zip.ZipException: error in opening zip file
> > at java.util.zip.ZipFile.open(Native Method)
> > at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
> > at java.util.zip.ZipFile.<init>(ZipFile.java, Compiled Code)
> > at weblogic.boot.ServerClassLoader.deploy(ServerClassLoader.java,
> > Compiled Code)
> > at
> >
> weblogic.cluster.AnnotatedServiceOffer.expandClassPath(AnnotatedServiceOffer
> > .java, Compiled Code)
> > at
> >
> weblogic.cluster.AnnotatedServiceOffer.readObject(AnnotatedServiceOffer.java
> > , Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
> > jectInputStreamBase.java, Compiled Co
> > de)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
> > treamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
> > tStreamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
> > eamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
> > treamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readArrayList(WLObjectInput
> > StreamBase.java, Compiled Code)
> > at weblogic.cluster.StateDump.readObject(StateDump.java, Compiled
> > Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readPublicSerializable(WLOb
> > jectInputStreamBase.java, Compiled Co
> > de)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readLeftover(WLObjectInputS
> > treamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readObjectBody(WLObjectInpu
> > tStreamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readObject(WLObjectInputStr
> > eamBase.java, Compiled Code)
> > at
> >
> weblogic.common.internal.WLObjectInputStreamBase.readObjectWL(WLObjectInputS
> > treamBase.java, Compiled Code)
> > at weblogic.cluster.TMSocket.execute(TMSocket.java, Compiled Code)
> > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
> > Code)
> >
> > The message freshed about every 20 seconds.
> >
> > Another question, I used a iplanet web server as a proxy server with a
> > cluster of two weblogic servers pluged in, although I set
> > weblogic.properties to round-robin, however, when I run a fibonacci
> servlet,
> > it does not do the round-robin. It always go to one machine for a lot of
> > times. Any idea?
> > Thank you for your help.
> > Tom
> >
> >
> >
-
How to open an MS-Word-File from a Java-Applikation ?
Hi,
i want to open an MS-Word-File from a Java-Applikation.
Something like this:
File myFile = new File("myFile.doc");
myFile.open(); //unfortunately this methode doesn't exist
Thanks for responseIn my opinion you have to use the Runtime.exec(String) method. I do not know the program name for msword.
You can open a file in notepad by invoking the method Runtime.getRuntime().exec("notepad c:/xyz/abc.txt");
Runtime runTime = Runtime.getRuntime();
runTime.exec("programName" + " " + file);
Of course the computer on which the program runs must have the application!
Hope this helps! -
I cannot open a file from lightroom into CC2014 unless I open it as a smart object. CC opens, just will not display my image. i am given an error code when I save an image, and can only save to my desktop or other locations, not automatically back into my lightroom.
I am using LR5 latest update, as well as CC2014
Below is the error message:
Line: 1 -> photoshop.notifyLightroomDocClosed ('lightroom-2.0', 'B53AFA39-A49B-4709-A9BD-0B6467C175C3', 'Macintosh HD:Users:BPexposures:Desktop:_DSC5962 as Smart Object-1.psd');I was also having this issue, and I did some more searching and found this answer in the Adobe forums: Re: Photos from Lightroom 5 to Photoshop CC (2014) and back.... The issue appears to be caused by having not updated Lightroom to the latest version prior to having CC2014 installed (wow that's stupid). The trick seems to be to uninstall Photoshop CC2014 and to then reinstall it after having upgraded to Lightroom 5.5.
-
Not able to open raw files from my CAnon 5D mark III in PS CS6!
I have camera raw 8.6 installed and am running photoshop cs 6.0. All of a suddened photoshop will not open raw pictures that were shot on a CAnon 5D mark III. Any ideas on what could be the problem. The pictures do open in light room.
Thanks
BruceWhat exactly happens when you try to open raw files from Canon 5D Mark III in PS CS6. Do you get any error message? An error screenshot would help.
Make sure your PS CS6 is up-to-date from Help > Updates.
Restart the machine and retry.
~ Arpit -
If I download a .mov file from gmail, I am not able to open the file. I reinstalled QuickTime 7.6.6, still unable to open the file. If I download the same file from another mail server I have no trouble. What is gmail doing to my file?
Also i have reinstalled the reader9 two times and tried with reader8 also but in both the cases same problem.
it would be gr8 help if someone can help. -
I am not able to open few files from my external hard disc in snow lepord
i am not able to open few files from my external hard disc in snow lepord
Need more information. Is there a message when you try to open them?
-
Can not open RAW-Files from Nikon D4 in Photoshop cc
hi. i can not open RAW-Files from Nikon D4 in Photoshop cc. (Camera RAW 6.7) can you help please?
ACR 6.7 would be for an older product, PS-CS5 or PSE10 or PRE10.
What does Help / About Plug-ins… / Camera Raw… show in PS-CC for a version for ACR and is there more than one version of ACR in the Help / About Plug-in list. Help / About Plug-in is what I’d do on Windows; I’m not sure if the menu path is the same on a Mac or not. -
I can not open NEF files from Nikon Df
I can not open NEF files from Nikon Df
Buongiorno a tutti,
qualcuno mi può essere di aiuto per utilizzare Camera RAW con i file NEF della nuova Nikon Df ?
Grazie infinite .
Hello everyone,
someone can help me to use Camera RAW NEF files with the new Nikon Df?
Thank you very much.This thread has instructions for importing Nikon Df raw files in Lr5.3RC (by making them look like Nikon D4 raw files):
http://forums.adobe.com/message/5920044#5920044 -
Photoshop CS5 will not open raw files from Nikon D810. What do I need?
Photoshop CS5 (bought in 2011) will not open raw files from Nikon D810 (bought in 2014). Is there a patch? Is there something I can do?
YAY!!! Success. Thanks Jim. I have the raw file for this image. ABC OPEN: Dancing water spouts in severe weather I'm such a noob, I hadn't even set up the correct date on the camera.
ABC OPEN: Dancing water spouts in severe weatherFran McFadzen captures a once in a lifetime photo of two dancing water spouts near Rockhampton.
View on open.abc.net.au
Preview by Yahoo
From: JimHess <[email protected]>
To: Fran McFadzen <[email protected]>
Sent: Monday, 26 January 2015, 10:20
Subject: Photoshop CS5 will not open raw files from Nikon D810. What do I need?
Photoshop CS5 will not open raw files from Nikon D810. What do I need?
created by JimHess in Adobe Camera Raw - View the full discussionThank camera requires Camera Raw 8.6 which isn't compatible with Photoshop CS5. But you can download DNG converter 8.6 or newer and create digital negative (DNG) copies that will be compatible with Photoshop CS5. If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7130665#7130665 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7130665#7130665 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following" Start a new discussion in Adobe Camera Raw by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.
Maybe you are looking for
-
SSO and LDAP no working after revokeing Territory selection choice of SSO
Hi i have 9ias 9.0.2 infrastructure on win 2k box. earlier the territory selection choice was checked. but when i unchecked that option. and i logged out of SSO. Now the problem is i am not getting the SSO and Internet Directory home pages. and in En
-
Import Tab for Service Purchase Order
Dear Friends, Is it possible to bring Import Tab (Foriegn Trade) at item level of Service Purchase Order. Please let me know the configuration step. Regards, S.Suresh
-
Itunes freezes when i try to play music
I just updated my iTunes, at first I had problems even opening the program. thankfully i worked with my security system to get it to open, but now everytime i try to play a song, it will freeze. I've tried everything that i know, please Help!
-
Does 9.3.1 really *require* UTF-8?
The "Installation Start Here" manual for release 9.3.1 makes a broad statement that databases must use the UTF-8 character set (see section entitled "Preparing Databases"). Has anyone out there successfully installed System 9 using non-UTF-8 Oracle r
-
Password prompt disappears at screensaver
I only just started using the screensaver, I used to use the "put display to sleep" option in its place but my new monitor seems to take much longer to wake so I've switched to screensaver with password on wakeup. It works as it should for maybe 2 or