Using GetResource to get a file from a different folder than bin
Hi guys,
here is the line of code I am working with:
final static URL musicD = Sound.class.getResource("Sound//MusicD.mid")this loads MusicD.mid from the project/bin/Sound folder. However, SVN messes up my bin folder badly, how can I get a resource from the project folder, or better yet project/sound folder as opposed to the bin folder? Thanks!
P.S. I am on a tight deadline, so a straight answer would be very helpful, what I dont need is more smug advice! =) thanks!
hiwa wrote:
Christ_Guard wrote:
Hi guys,
here is the line of code I am working with:
final static URL musicD = Sound.class.getResource("Sound//MusicD.mid")this loads MusicD.mid from the project/bin/Sound folder. However, SVN messes up my bin folder badly, how can I get a resource from the project folder, or better yet project/sound folder as opposed to the bin folder? The syntax is wrong. Besides, what is your current current directory from where your application is launched? Is it in a jar file?Thanks for the honest help, I really appreciate it! I am working out of eclipse and compiling it there, so it is not yet a jar file. How would you suggest fixing the syntax to work?
P.S.
the directory I am working from is this:
C:\Users\Christian\TCSS 305 Workspace\shielc-tetristhis directory has the src and bin directories, yet I dont know how to get the resources from this directory instead of the bin directory.
Similar Messages
-
Is it possible to save the screenshot files to a different folder than desktop (that is the default). How can I change the destination folder? Thank you, Sal
To change the screenshot capture location to a new place on your Mac, first think of a location that would serve you properly. We like to place ours in a "Screenshot" folder located inside of the User's "Pictures" folder. To change the location to this new location, open the Terminal and enter the following command:
defaults write com.apple.screencapture location /Users/[u]/Pictures/Screenshots/
Replace "[u]" with the name of the user on your system. Once you have entered this command, let's restart the screen capture utility by restarting the SystemUIServer by entering the following command:
killall SystemUIServer
You can optionally log out and back in instead of entering this second command, thus restarting the SystemUIServer. Once restarted, all screen captures taken from here on out will end up in your /Pictures/Screenshots/ folder in the User's home folder on your Mac. -
Restore file to a different folder than original?
Hi I work with a lot of password protected word documents (can't be viewed in quick look)... and often want to look at the changes that are made with previous versions. Is there a way to be able to restore time machine backups to a different folder so it doesnt overwrite the current version
Yes, you can!
While in the TM interface, just choose the file(s) that you want to restore to a different location, click on the Gear Icon and choose "Copy ...". Then come out of the TM browser by clicking Cancel or pressing Esc key and browse over to the destination folder in the Finer. Right click and choose "Paste ...". This will restore the file from your chosen backup to this folder. -
How to generate & publish webhelp html files in different folder than default folder
Hi All,
I am new to robo help. I have a requirement to generate & publish webhelp html files in a different folder than default folder.
Could anyone please tell me the steps to change the folder
Thanks
RashmiYou change the generate folder and filename in the first field on the first page of the wizard. It must be a folder on your hard disk.
You change the publish folder in the last page of the wizard. Anywhere you like.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
When using Migration Assistant to transfer files from my pc, I get an error message saying that an attempt was made to access a socket in a way forbidden by its access permissions. How can I fix this?
You followed:
http://www.apple.com/support/switch101/ -
I'm using migration assistant to transfer files from my wife old net book to new mac air and the pc dropped out during transfer. I started up migration assistant on the Pc again and now says waiting for mac to connect! New MacBook Air is stuck at transferring information. How do I get the process to reconnect and continue?
Whew, good luck!
What version of OSX is on the older one? -
How can I get hidden files from an external device with terminal?
Here is my situation. I have an mp3 player that is a Sansa Clipp. This version has third party firmware installed that not only hides the music files but will not let me copy them at all when I do a straight copy. All I get are empty folders. I want to install the actual firmware but first I need to back up the entire contents of the device because essentially I need to wipe the malicious firmware and everything else off the disc in order to to this. This device came from the Bureau of Prisons and is sold to prisoners. It is basically locked to the hilt and the only way to unlock it officially is to send it to the third party that installed the firmware and pay them $25. I know that I should be able to use terminal to get the files off of this but so far a "cp" command has only given me the files that I get when I drag and drop. The music files seem to be hidden in a partition that I can't access. Let me know if anyone has any help they can give. I just need to back up the full contents of the device. I have instructions on how to wipe it and reinstall but backing up is crucial to this. Thanks for any help and please ask questions if I haven't made my problem clear enough.
I have know way of knowing whether or not this will copy the data. The device could have some hidden hand-shack.
I assume the Sansa Clipp is a usb connected device. The method works for a flash drive. There is a different method for a harddrive..
First, you need to find the name of the device. Mount the device.
/Applications/Utilities/Terminal.
# run the df command. type command then press return.
mac $ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s16 272G 259G 12G 95% /
devfs 113K 113K 0B 100% /dev
fdesc 1.0K 1.0K 0B 100% /dev
<volfs> 512K 512K 0B 100% /.vol
automount -nsl [217] 0B 0B 0B 100% /Network
automount -fstab [222] 0B 0B 0B 100% /automount/Servers
automount -static [222] 0B 0B 0B 100% /automount/static
/dev/disk1s10 500G 302G 197G 60% /Volumes/ServiceRepairManuals
/dev/disk1s14 80G 50G 30G 62% /Volumes/Second-80
/dev/disk2s1 446M 15M 431M 3% /Volumes/2partitions
/dev/disk2s2 46M 9.0M 37M 20% /Volumes/second-disk
mac $ # unmount disk by dragging to trash can.
mac $ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s16 272G 259G 12G 95% /
devfs 112K 112K 0B 100% /dev
fdesc 1.0K 1.0K 0B 100% /dev
<volfs> 512K 512K 0B 100% /.vol
automount -nsl [217] 0B 0B 0B 100% /Network
automount -fstab [222] 0B 0B 0B 100% /automount/Servers
automount -static [222] 0B 0B 0B 100% /automount/static
/dev/disk1s10 500G 302G 197G 60% /Volumes/ServiceRepairManuals
/dev/disk1s14 80G 50G 30G 62% /Volumes/Second-80
mac $ # figure out the name of the device.
mac $ # see what dev disappeared.
mac $ # in this case the unix names of the partitions are: /dev/disk2s1 & dev/disk2s2
mac $ # the device, flash name, is /dev/disk2
mac $ # pull out the device from it's usb port. Plug it back in.
mac $ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/disk1s16 272G 259G 12G 95% /
devfs 113K 113K 0B 100% /dev
fdesc 1.0K 1.0K 0B 100% /dev
<volfs> 512K 512K 0B 100% /.vol
automount -nsl [217] 0B 0B 0B 100% /Network
automount -fstab [222] 0B 0B 0B 100% /automount/Servers
automount -static [222] 0B 0B 0B 100% /automount/static
/dev/disk1s10 500G 302G 197G 60% /Volumes/ServiceRepairManuals
/dev/disk1s14 80G 50G 30G 62% /Volumes/Second-80
/dev/disk2s1 446M 15M 431M 3% /Volumes/2partitions
/dev/disk2s2 46M 9.0M 37M 20% /Volumes/second-disk
mac $ dd if=/dev/disk2 bs=4096 | gzip | dd of=~/disk2-s1-2 bs=4096
dd: /dev/disk2: No such file or directory
0+1 records in
0+1 records out
20 bytes transferred in 0.014734 secs (1357 bytes/sec)
mac $ -
How to get a file from an internet site
I have a scenario where I need to get a file from a website.
Basically on a weekly basis one our customers are going to upload a file that contains all the information for delivery's for the coming week.
the way this used to be done is the user would go to the website directly and download the uploaded file.
However now we want to do it as an automatic integration using PI.
Does anyone have an idea how to do this? Is it even possible?> Thridly my issue with regards to taking a file that is uploaded to a website (it will be a csv file), can be solved by creating a webservice?
I am sorry, I misunderstood this. I thought you want to download.
The upload is done with a HTTP POST, so you can use the HTTP receiver adapter.
Use the prolog and epilog to simulate the form data post.
Use an HTTP sniffer to get the whole HTTP stream, when you upload the file to the website to see, what you have to put in the HTTP adapter settings.
Here are some threads about that topic:
Receiver HTTP Adapter - multipart/form-data file post - SP19
Re: HTTP Form Post Using HTTP adapter
Regards
Stefan -
Hi All,
My requirment is to get releted files from Local Directory.
For Example Path is "D/Data/"
in this path there is files like
abc123_de.txt
abc123_en.txt
xyz123_de.txt
abc123_pt.txt
xyz123_en.txt
pqr123_en.txt
bcg234_en.txt
sjd467_en.txt
Now i want to use only files which are strart from abc123 and use their data.
From which FM i can do it or how can i do this?
Thanks,
MahipalsinhDear Mahipalsinh,
I have got the same requirement some days back, i think there is no FM for your requirement. so what i did, i have get all the files using below FM and Concatenate the ABC.
Please use the Below FM, because if the file name is above that 50 character that time always it gives the full file name. Please check, if u used the other one for getting the Files.
CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING'
EXPORTING
iv_dir_name = lv_dir_name
TABLES
dir_list = lt_file_name
EXCEPTIONS
invalid_eps_subdir = 1
sapgparam_failed = 2
build_directory_failed = 3
no_authorization = 4
read_directory_failed = 5
too_many_read_errors = 6
empty_directory_list = 7
OTHERS = 8.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
For reading Specific Files.
CONCATENATE 'AP' lv_internal_date INTO lv_filename.
LOOP AT lt_file_name INTO ls_file_name.
lv_index = sy-tabix.
IF ls_file_name-name CS lv_filename.
" PUT YOUR LOGIC
endif.
endloop.
Thanks,
Nishant -
Is there any way to get the files from other computer ?
Hai all,
I have 2 computers connected. I know the IP address of other computer. Is there any way to get the files from other computer. (for e.g. I want to get the files from specific folder. In Java netwroking is it possible? (Any programs)
regards,
NamancBro Take it easy.
Think you need to send a Image file named ("abc.gif")
now develop a server using ServerSocket and connect it in local IP and any PORT
For example i think ur server is connected in "localhost" and 9000 port.
Now make ur server educated using some commands.
For example:
FileName: <File Name String>
[Means new file is sending by connected client]
FileSize: <File size long or int value>
[ So that ur server can determind about the total length of sender file]
DataModeOpen
[Now your client will send its image data, this command means your client software is sending data]
fjadlkfjaofaijojfwoeiurfodkjflsajlfksa
l23j4lj23lkjlasjfoq23j4rokjelfkjasldkf
2o3j4lk2j3ljslakdjf2l3j4 l23kjlk23k4j
DataModeClose
[Means file sending finished]
Close
[Means your client connection is closed]
Now develop a client supporting this command.
For example(Server):
String getFileName=null;
long getFileSize=0;
public handleCommand(String getCmd) {
if(getCmd.startsWith("FileName")) {
String[] splitData=getCmd.split(":");
this.getFileName= splitData[1];
outPutStream.writeBytes("+OK");
} else if(getCmd.startsWith("FileSize")) {
String[] splitData=getCmd.split(":");
this.getFileSize=Long.parseLong(splitData[1]);
outPutStream.writeBytes("+OK");
} else if(getCmd.startsWith("DataModeOpen")) {
//data mode open so receive data
receiveData();
outPutStream.writeBytes("+OK");
} else if(getCmd.startsWith("DataModeClose")) {
//close client socket
getClientSocket.close();
}For client:
DataInputStream dataIn=null;
BufferedOutputStream bout=null;
public sendFile(bytes[] getBytes) {
//if ok found then do other or show error message
if(sendCmd("FileName:"+getFileName)) {
if(sendCmd("FileSize:"+getFileSize)) {
if(sendCmd("DataModeOpen")) {
bout.write(getBytes);
} else {
showError(3);
} else {
showError(2);
} else {
showError(1);
}i think it will help u -
How do I get GarageBand files from an older mac onto my iPad 2?
How do I get GarageBand files from an older mac onto my iPad 2? I can open the GarageBand Documents folder through iTunes while the iPad is sync'd but I can't seem to "add..." any of my old .band folders to the iPad to be able to view those music projects. When I tried I could only sync individual data files contained in the .band folders over to the iPad and there was no way to organize them into .band project folders. What can I do here to get these GarageBand projects onto my iPad for further use?
This is not currently possible. You can transfer an iPad project to the Mac, and transfer songs/loops from the Mac to iPad, but not GB files from Mac to iPad.
Send feedback
http://www.apple.com/feedback/ -
How do i get my files from windows laptop to my new iMac?
how do i get my files from laptop to my new imac?
You can use Migration Assistant or Manually move files using an External Hard Drive.
see > Switch Basics: Migrate your Windows files or system to your Mac
You can also use your home network to share files with the new iMac.
see > Mac Basics: File Sharing -
Functional module to get the File from a given Directory
Hi all,
I am using a FM name 'subst_get_file_list' to get the file from a given directory but it is accepting only 40 Character length file only my requirement is to accept file name other than 40 char,
give me good sugestion
regards
paulHi Paul,
Check the Function Module Gayathri has given. ie. 'SO_SPLIT_FILE_AND_PATH'.
In the exporting parameter FULL_NAME , give the path name and in the importing parameter stripped_name , you will get the filename.
Check this code.
REPORT ZSHAIL_SPLITFILE.
data: it_tab type filetable with header line,
gd_subrc type i.
tables: rlgrap.
data: path type string,
file_name type string.
parameters file_nam type rlgrap-filename .
data: user_act type i.
at selection-screen on value-request for file_nam.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
WINDOW_TITLE = 'select a file'
DEFAULT_EXTENSION = '*.txt
DEFAULT_FILENAME = ''
FILE_FILTER = '*.txt'
INITIAL_DIRECTORY = ''
MULTISELECTION = abap_false
WITH_ENCODING =
CHANGING
file_table = it_tab[]
rc = gd_subrc
USER_ACTION = user_act
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if user_act = '0'.
loop at it_tab.
file_nam = it_tab-filename.
endloop.
endif.
path = file_nam.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = path
IMPORTING
STRIPPED_NAME = file_name
FILE_PATH =
EXCEPTIONS
X_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
at selection-screen.
message i001(zmess) with file_name.
Regards,
SP. -
Hi How to get XML file from servlet that XI sent to my J2EE appl?
Hi All!
I have a scenario like XI sends xml file to j2ee application. In my J2EE application my servlet receives this xml. Will the xml file be in my HTTPServletRequest object? if so how to get that file from Request object.
Please help me its urgent, Any code help is highly appreciated.
My xml file will be like this:
<ns0:Http_Message_Type_Demo
xmlns:ns0="http://abcdemo.com">
<Name>ABC</Name>
<RollNo>123</RollNo>
<Address>a-4</Address>
</ns0:Http_Message_Type_Demo>
somebody should help me!please
ThanksHi,
You can use HTTPServletRequest object to get the XML payload.
BufferedReader reader = request.getReader(); //gets XML payload
String line = reader.readLine(); // to read the XML payload line by line
(request is the HTTPServletRequest object)
Regards,
Uma -
How to use utl_ftp package to transfer files from one system to another
Hi all,
How to use utl_ftp package to transfer files from one system to another using plsql procedure .
I failed to find the appropriate document ,kindly help me .
Thanks,
P Prakashprakash wrote:
I am sorry tell you, this blog is not enough to for me.It's not a blog, it's Chris' website where you download the package from. Once you download the package and unrar it, then the package spec gives instructions (and I think there's instructions on how to install it too).
Kindly let me know if there is any oracle documentation for this .It's not an Oracle created package, it was created by Chris. It's based around the UTL_TCP package if you really want to get into the nitty gritty of how it works, but I don't think you do.
Maybe you are looking for
-
I was just given a Mid 2009 MacBook Pro. It does not have a system on it.
I have my original disks from my early 2009 MacBook Pro. When I try to use the OS Install disk to install 10.5, which is what the early MacBook came with, it won't boot the computer. I have the upgrade to 10.6.3, but it will not work either, since it
-
How do I add a list of numbers stored in an array
How do I add a list of numbers stored in an array? The code I have is showing 'NaN' when I try to add the second item in each element of the array: var aItemPrices:Array = new Array(["item1_mc", 10], ["item 2_mc", 20], ["item 3_mc", 30]); var totalPr
-
How do I set ClientCredentials property to windows credentials?
As per MSDN http://technet.microsoft.com/en-us/library/92a9678c-bc4f-4d7a-ba44-85989bfe27ca Building Applications Using the Reporting Web Service and the .NET Framework we have to set Credentials as below ReportingService2010 rs = new ReportingServic
-
Quicktime Audio Disappears after Publishing
Hi - I'm using iWeb 09; I have long been using iWeb to publish my website - part of that has been uploading mp3 files for people to listen to. My problem is suddenly my files, which play perfectly in iWeb, don't even show up on the page after I publi
-
When I try to open a particular website I get a pageck in the upper left hand corner of the screen and the website won't open.