Trying to Get a Path using CFBundleCopyResourceURL
So I'm having an issue loading a resource. I'm using Carbon/C++. The problem is that when I try to load a file path with the following code the string returned is a cut off version of what I really need. When debugging the call to CFBundleCopyResourceURL looks like the culprit since the path it returns is a bunch of characters short of the actual path.
const char* Game::GetResourcePath(const char* resourceName, const char* resourceType)
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFStringRef resName =
CFStringCreateWithCString(kCFAllocatorDefault, resourceName,
GetApplicationTextEncoding());
CFStringRef resType =
CFStringCreateWithCString(kCFAllocatorDefault, resourceType,
GetApplicationTextEncoding());
CFURLRef URLref = CFBundleCopyResourceURL( mainBundle, resName, resType, NULL );
CFStringRef texBoxPath = CFURLCopyPath(URLref);
const char* path= CFStringGetCStringPtr(texBoxPath, GetApplicationTextEncoding());
return path;
}
What environment are you using? Ensure the Oracle JDBC driver is on your classpath.
Note that oracle.jdbc.driver.OracleDriver is old, oracle.jdbc.OracleDriver should be used for Oracle JDBC now.
Try calling jdbc DriverManager with your URL directly, does it work?
James : http://www.eclipse.org/eclipselink/
Similar Messages
-
I am trying to get authorisation to use Adobe digital edition, but my book's vendor is not on the list, and hence the password not accepted.
Numbers documents from iOS need Numbers 3.2 on a Mac to open. And Numbers 3.2 requires Mavericks. If you are using Mavericks you can get Numbers 3.2 from the Mac App Store. It will be free IF you have Numbers 2 (iWork '09) installed. Otherwise you must buy it.
Your other option is to send the Numbers file as an Excel file via e-mail to yourself to open with an earlier version of Numbers. -
Getting socket error while trying to get oracle connection using JDBC
hi,
I am getting following socket read error while trying to get database connection using JDBC. This happening with jdk1.5.0_12 version with Oracle 9i
following is the stacktrace...
Thread t@92: (state = IN_NATIVE)
- java.net.SocketInputStream.socketRead0(java.io.FileDescriptor, byte[], int, int, int) @bci=0 (Compiled frame; information may be imprecise)
- java.net.SocketInputStream.read(byte[], int, int) @bci=84, line=129 (Compiled frame)
- oracle.net.ns.Packet.receive() @bci=31 (Compiled frame)
- oracle.net.ns.DataPacket.receive() @bci=1 (Interpreted frame)
- oracle.net.ns.NetInputStream.getNextPacket() @bci=48 (Compiled frame)
- oracle.jdbc.driver.T4CMAREngine.unmarshalSB1() @bci=1, line=1070 (Compiled frame)
- oracle.jdbc.driver.T4CStatement.doOall8(boolean, boolean, boolean, boolean) @bci=617, line=207 (Compiled frame)
- oracle.jdbc.driver.T4CStatement.executeForDescribe() @bci=39, line=790 (Compiled frame)
- oracle.jdbc.driver.OracleStatement.executeMaybeDescribe() @bci=106, line=1039 (Interpreted frame)
- oracle.jdbc.driver.T4CStatement.executeMaybeDescribe() @bci=11, line=830 (Interpreted frame)
- oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout() @bci=128, line=1132 (Interpreted frame)
- oracle.jdbc.driver.OracleStatement.executeQuery(java.lang.String) @bci=76, line=1272 (Interpreted frame)
any help would appreciated. thanks in advanceI do not have exact exception message.
additionally, i have got following the tomcat log file:
INFO - Resource pool cleanup thread just woke up.
Nov 1, 2008 3:41:52 AM org.apache.tomcat.util.threads.ThreadPool logFull
SEVERE: All threads (100) are currently busy, waiting. Increase maxThreads (100) or check the servlet status
INFO - Resource pool cleanup thread just woke up.
thanks in advance -
Getting exception when trying to get taskdetails url using BPM worklist api
Getting exception when trying to get taskdetails url using BPM worklist api method :
String url = WorklistUtil.getTaskDisplayURL(
wfSvcClient,
ctx,
task,
null,
"worklist",
parameters);
Jul 21, 2011 11:24:40 AM oracle.bpel.services.common.ServicesLogger __log
WARNING: <oracle.bpel.services.workflow.client.worklist.util.TaskFlowPropsUtil.getServerPropertiesFromMbean()> Exception while loading install config file in standalone Error : javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean
oracle.fabric.common.FabricException: javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean
at oracle.soa.common.util.PlatformUtils.getServerInfo(PlatformUtils.java:184)
at oracle.bpel.services.workflow.client.worklist.util.TaskFlowPropsUtil.getServerPropertiesFromMbean(TaskFlowPropsUtil.java:319)
at oracle.bpel.services.workflow.client.worklist.util.TaskFlowPropsUtil.getServerInfoForWeblogicServer(TaskFlowPropsUtil.java:491)
at oracle.bpel.services.workflow.client.worklist.util.TaskFlowPropsUtil.getServerInfo(TaskFlowPropsUtil.java:363)
at oracle.bpel.services.workflow.worklist.api.util.WorklistUtil.getDefaultURLPrefix(WorklistUtil.java:264)
at oracle.bpel.services.workflow.worklist.api.util.WorklistUtil.getTaskDisplayURL(WorklistUtil.java:353)
at oracle.bpel.services.workflow.worklist.api.util.WorklistUtil.getTaskDisplayURL(WorklistUtil.java:293)
at com.test.WorflowServiceClient.main(WorflowServiceClient.java:198)
Caused by: javax.management.InstanceNotFoundException: com.bea:Name=RuntimeService,Type=weblogic.management.mbeanservers.runtime.RuntimeServiceMBean
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:662)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:638)
at oracle.as.jmx.framework.config.session.ConfigurationMBeanServerImpl.getAttribute(ConfigurationMBeanServerImpl.java:210)
at oracle.soa.common.util.PlatformUtils.getServerInfo(PlatformUtils.java:78)
... 7 more
Caught workflow exception: null
Process exited with exit code 0.
Can anyone please help meActually i'm using Jdeveloper 11.1.1.4 and our requirement is to show list of BPM worklist tasks for the logged in user on the first page and onclick of each task task details page should be opened. I can use Webcenter PS3 worklist taskflow. But i'm not able to customize that taskflow. So, i'm going for Worklist client api.
I'm able to retrive the taskId,task title and few other details like task payload. But i don't know why the below method is giving exception.
String url =
WorklistUtil.getTaskDisplayURL(wfSvcClient,
ctx, task, null,
"worklist", parameters);
And i observed that you have also used the same code for getting Taskdetails url. And one more thing is i'm trying to access BPM worklist which is installed on remote machine.
Can you tell me what could be the reason for the exception? -
Trying to get newest record using a select statement
Hello everyone.. I'm a bit new at this but I've been teaching myself by trial and error so bear with me.
Using a 'DEDUCTION' table for this example, I am trying to get it to resolve the record that is most current. Since each employee record could have changes, the table could have multiple entries/deductions of which only one is the most current.
Ok, so medical deductions are like DEDUCTIONS 700-715 while dental deductions are 730-737. Initially, I was trying to figure out how to pull the deductions based on an employee and have it compare which is newer and report the newest one for each medical and then the dental deduction. If there is not a type of deduction for someone, it should report zero like a NVL I think. See example:
EMP_ID DEDUCTIONS EFF_DATE AMT
1 710 2000/12/01 85.39
1 735 2000/12/01 8.31
9 701 2001/08/29 12
9 707 2000/12/01 12
9 730 2000/12/01 .23
10 700 2001/02/25 .46
10 730 2001/02/25 .23
The record that stands out in this example is employee #9 with two medical deduction, one that supersedes the other - 701 and 707. Because 701 is newer it should ignore the 707 deduction.
Any ideas? Thank you!
kenHere are a couple of methods. The second one should run faster, but requires Oracle 8i.
SQL> SELECT emp_id, deductions, eff_date, amt,
2 'MEDICAL' AS type
3 FROM deduction
4 WHERE (emp_id, eff_date) IN
5 (SELECT emp_id, MAX (eff_date)
6 FROM deduction
7 WHERE deductions BETWEEN 700 AND 715
8 GROUP BY emp_id)
9 AND deductions BETWEEN 700 AND 715
10 UNION
11 SELECT emp_id, deductions, eff_date, amt,
12 'DENTAL' AS type
13 FROM deduction
14 WHERE (emp_id, eff_date) IN
15 (SELECT emp_id, MAX (eff_date)
16 FROM deduction
17 WHERE deductions BETWEEN 730 AND 737
18 GROUP BY emp_id)
19 AND deductions BETWEEN 730 AND 737
20 ORDER BY emp_id, deductions
21 /
EMP_ID DEDUCTIONS EFF_DATE AMT TYPE
1 710 2000/12/01 85.39 MEDICAL
1 735 2000/12/01 8.31 DENTAL
9 701 2001/08/29 12 MEDICAL
9 730 2000/12/01 .23 DENTAL
10 700 2001/02/25 .46 MEDICAL
10 730 2001/02/25 .23 DENTAL
6 rows selected.
SQL> SELECT emp_id, deductions, eff_date, amt,
2 'MEDICAL' AS type
3 FROM (SELECT emp_id, deductions, eff_date, amt,
4 RANK () OVER
5 (PARTITION BY emp_id
6 ORDER BY eff_date DESC) AS rk
7 FROM deduction
8 WHERE deductions BETWEEN 700 AND 715)
9 WHERE rk = 1
10 UNION
11 SELECT emp_id, deductions, eff_date, amt,
12 'DENTAL' AS type
13 FROM (SELECT emp_id, deductions, eff_date, amt,
14 RANK () OVER
15 (PARTITION BY emp_id
16 ORDER BY eff_date DESC) AS rk
17 FROM deduction
18 WHERE deductions BETWEEN 730 AND 737)
19 WHERE rk = 1
20 ORDER BY emp_id, deductions
21 /
EMP_ID DEDUCTIONS EFF_DATE AMT TYPE
1 710 2000/12/01 85.39 MEDICAL
1 735 2000/12/01 8.31 DENTAL
9 701 2001/08/29 12 MEDICAL
9 730 2000/12/01 .23 DENTAL
10 700 2001/02/25 .46 MEDICAL
10 730 2001/02/25 .23 DENTAL
6 rows selected. -
Function to get the path using a parent-child relationship
Hello,
I have a table which uses parent-child relationship to store the options available. I need a function to give me the full path given the id of a particular option.
I have two different functions. One of them uses the Oracle built in function and the other uses simple queries with a loop.The code of the functions are given below.
Now, the problem is with their "performance". The difference in their performance is significant. The function using the Oracle function takes more than 2 hours to run a query whereas the other function takes less than 2 minutes.
I am having trouble trusting the other function. No matter how many tests I perform on the output of both the functions, it always comes out to be the same.
Any thoughts to help me understand this ??
Function 1
=====================
FUNCTION Gettree (opt_id IN NUMBER,i_app_id IN NUMBER)
RETURN VARCHAR2
IS
path VARCHAR2(32767);
application_no NUMBER;
BEGIN
SELECT ABC.APP_OPT_ID INTO application_no FROM ABC
WHERE ABC.APP_ID = i_app_id AND ABC.PARENT_ID IS NULL;
SELECT LPAD(' ', 2*LEVEL-1)||SYS_CONNECT_BY_PATH(app_opt_name, '=>') "Path" INTO path
FROM ABC
WHERE app_opt_id = opt_id
START WITH parent_id =application_no
CONNECT BY PRIOR app_opt_id =parent_id;
path := SUBSTR(path,INSTR(path,'>')+1,LENGTH(path));
RETURN path;
END Gettree ;
Function 2
======================
FUNCTION GetOptPath(opt_id NUMBER,app_id NUMBER)
RETURN VARCHAR2
IS
string VARCHAR2(900);
opt VARCHAR2(100);
pid NUMBER(38);
BEGIN
SELECT ABC.parent_id,ABC.app_opt_name INTO pid,string FROM ABC WHERE ABC.app_opt_id = opt_id;
IF pid IS NULL
THEN
RETURN 'root';
ELSIF pid IS NOT NULL
THEN
LOOP
SELECT ABC.app_opt_name,ABC.parent_id INTO opt, pid FROM ABC WHERE ABC.app_opt_id = pid;
EXIT WHEN pid IS NULL;
string := opt || '=>'|| string;
END LOOP;
RETURN string;
END IF;
END;Hi,
user8653480 wrote:
Hello Frank,
The parameters taken by gettree & getoptpath are app_opt_id and app_id and both the functions return only one string i.e. the path of that particular option (app_opt_id) starting from its root and not all the descendants of that option/root node of that option.
So, does that mean that gettree first fetches all the descendants of the root node of the given option and then returns the required one ??Yes. It's a little like the situation where you need to meet with your co-worker Amy, so you send an e-mail to everyone in the department telling them to come to your office, and then, when they arrive, tell everyone except Amy that they can leave.
>
And if that is the case, then won't it be better to use the bottom-up approach to fetch the required path just for that particular option ?? 'coz my requirement is that only.. given an option_id get the full path starting from the root.Exactly!
I have used explain plan also for both the functions.. but since I did not know how to anlayze the output from plan_table so I just compared the value in the fields and they were exactly the same for both the queries.If you'd like help analyzing the plans, post them, as Centinul said.
I am attaching a sample data with the outputs of both the functions for the reference.
(tried attaching the file but could not find the option, so pasting the data here)
App_opt_ID App_ID Parent_ID App_opt_name "gettree(app_opt_id,app_id)" "getoptpath(app_opt_id,app_id)"
1 1 NULL application NULL root
2 1 1 module1 module1 module1
3 1 1 module2 module2 module2
4 1 2 submod1 module1=>submod1 module1=>submod1
5 1 3 submod1 module2=>submod1 module2=>submod1
6 1 5 opt1 module2=>submod1=>opt1 module2=>submod1=>opt1
7 2 NULL app2 NULL root
8 2 7 scr1 scr1 scr1
9 2 8 opt1 scr1=>opt1 scr1=>opt1
10 2 7 scr2 scr2 scr2Please help.The best solution is to do a bottom-up query, and write a function like reverse_path (described in my first message) to manipulate the string returned by SYS_CONNECT_BY_PATH. You seem to have all the PL/SQL skills needed for this.
Another approach is a revised form of gettree, like I posted earlier. Does it do what you want or not?
If you'd help, then post a little sample data in a form people can actually use, such as CREATE TABLE and INSERT statements. Post a few sets of parameters, and the results you need from each set, given the sample data posted. -
Hello everybody,
I am working on uploading file from page to another one using HTP package, but whenever I submit the form, it only takes the filename without the full path.
for example :
if i sent 'c:\dir\a.txt' , the other page receives file parameter as 'a.txt'
the code is here
PROCEDURE upload(appno in varchar2,wsct in varchar2) AS
l_real_name VARCHAR2(1000);
BEGIN
HTP.htmlopen;
HTP.headopen;
HTP.title('Test Upload');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Test Upload');
HTP.print('<form action="https://ssltrng.uaeu.ac.ae/trng/document_api.upload1" method="get">');
HTP.print(' File to upload: <input type="file" name="file" >
HTP.print(' <input type="submit" value="Upload">');
HTP.print('</form>');
HTP.bodyclose;
HTP.htmlclose;
END upload;
the other page see it as
file is 'Water lilies.jpg'
Thanks
Edited by: dtabed on Mar 30, 2011 1:02 AMDo not understand the problem.
The code you've posted is a PL/SQL web enabled procedure that produces a dynamic HTML page. This page contains a form. And a full URL reference to the CGI that will process the form's data.
This is unusual - as it seems to be that the form is submitted across domains and web servers.. You usually refer to a local CGI procedure to deal with a form - no need for a fully qualified URL that includes web server and domain name.
If the CGI procedure that receives the form is also a PL/SQL web enabled procedure, that the uploaded file will be placed in the documents table (as defined in the DAD alias) by mod_plsql, prior to the web enabled procedure being called. The documents table will contain the Mime type, file name, file contents and other details. -
How to get full Path using sADMBasic- StandardGetDirectoryDialog on mac
hi,
While implementing a plug-in, I am using sADMBasic->StandardGetDirectoryDialog to prompt a dialog to select the folder.code is as follow-
SPPlatformFileSpecification outResult = {NULL};
Boolean isDirSelected = sADMBasic->StandardGetDirectoryDialog("Select folder Location", NULL, &outResult);
In window, I am getting the fullpath in outResult.path. but in Mac ,I am getting 3 things outResult.vRefNum,outResult.parID,outResult.name.
suppose anyone selected the desktop when dialog prompt. The outResult.name contains only the string like"a\ desktop ".And parId contains a integer no.
But I want fullpath like User/Desktop. is there any way to get the fullpath from these variables?
thanks
DeepAloneDo not understand the problem.
The code you've posted is a PL/SQL web enabled procedure that produces a dynamic HTML page. This page contains a form. And a full URL reference to the CGI that will process the form's data.
This is unusual - as it seems to be that the form is submitted across domains and web servers.. You usually refer to a local CGI procedure to deal with a form - no need for a fully qualified URL that includes web server and domain name.
If the CGI procedure that receives the form is also a PL/SQL web enabled procedure, that the uploaded file will be placed in the documents table (as defined in the DAD alias) by mod_plsql, prior to the web enabled procedure being called. The documents table will contain the Mime type, file name, file contents and other details. -
Trying to get laptop to use printer hooked up to my PC.
i have a Hp pavilion g7-1227nr laptop and a HP photosmart C5580 printer. i have downloaded every HP solution for the printer but nothing will let me print from my laptop (wireless) to the printer that is hooked up to my PC. Both of my children have HP laptops and they cannot get their laptops to print to the printer either. Any suggestions?
Hi sonewald1,
hope you are doing well and sorry to learn that you are having this issue.
Have you shared the printer in your network? you have to do this in order to be able to use the printer from other computers unless you have a router that is capable of been used as a printer server which you can check on your router's owner manual.
Follow this;
Click on Start in the bottom left corner of your screen. A popup list will appear.
Select Control Panel from the popup list. Type the word network in the search box.
Click on Network and Sharing Center.
Click on Change advanced shared settings, in the left pane.
Click on the down arrow, which will expand the network profile.
Select File and printer sharing and choose Turn on file and printer sharing.
Click on Save changes.
You're now ready to share your printer.
Click on Start in the bottom left corner of your screen. A popup list will appear.
Click on Devices and Printers, from the popup list.
Right click the printer you want to share. A dropdown list will appear.
Select Printer properties from the dropdown list.
Click on the Sharing tab
Select the Share this printer check box.
In order for other people to connect to the printer, they just have to add the network printer that you just opened for sharing to their computers. Here's how to do this.
Click on Start in the bottom left corner of your screen. A popup list will appear.
Click on Devices and Printers from the popup list.
Select Add a printer.
Click on Add a network, wireless or Bluetooth printer.
Click the shared printer.
Click Next. Continue according to the instructions on the screen [source: Microsoft].
Hope it helps;
RobertoR
You can say THANKS by clicking the KUDOS STAR. If my suggestion resolves your issue Mark as a "SOLUTION" this way others can benefit Thanks in Advance! -
Trying to get resolutions set using a NVIDIA Geforce 7300 GT
I have a MAc Pro dual 2.66 it has a 7300 video card. I have a 30" cinema display plugged into the dual DVI link to give me a resolution of 2560 x 1600 . In the single channel DVI I have an Olympus Projector displaying at 1024x768 ( max res for said projector.)
Is there a way to have full resolution of both at the same time?
Is there a way for the computer to switch back to full resolution to the cinema display when the projector is off? without unplugging the projector?
would it be beneficial to run them off different video cards?Is there a way to have full resolution of both at the same time?
Only if you turn off Mirroring in the "Arrangement" tab of "Displays" system preference.
Would it be beneficial to run them off different video cards?
No. It is better to have both displays on one card. -
This has been happening for 2 or 3 days and it is annoying as hell. Very top left it says Mozilla Firefox. 1- I do not need or want the Firefox and 2- is it safe to download
Hello,
In order to better assist you with your issue please provide us with a screenshot. If you need help to create a screenshot, please see [[How do I create a screenshot of my problem?]]
Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
You should also check for malware.
You can try these free programs to scan for malware, which work with your existing antivirus software:
* [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
* [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
* [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
* [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
* [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
Thanks in advance! -
How to get complete path when uploading a file in Mozzila
Hi
I was trying to upload a file using html code
<input type="file" name="cdrfile">
then I wrote
<% = request.getParameter("cdrfile")%>
trying to get the path and the file name. But Mozilla doesn't return me the complete path only the file name. Does anyone know how to get the complete path in Mozilla?
Cheers
MDeliberate double post:
http://forum.java.sun.com/thread.jspa?threadID=5147786&messageID=9551206#9551206 -
Hi All,
I am trying to get BPEL users using SOA suite 10.1.3.1
I am using the BPMAuthorizationService in order to invoke method search users passing the filter with * so that it will get all users:
BPMAuthorizationService authSvc = wfSvcClient.getAuthorizationService(wfCtx.getIdentityContext());
List list = authSvc.searchUsers(filter);
where the filter is :
ComplexSearchFilter filter = authSvc.getSearchFilterInstance(BPMUser.class, sSearchableAttributes[0], SearchFilter.OPERATOR_EQUAL, "*");
filter.setLogicalOperator(ComplexSearchFilter.LOGICAL_OPERAND_OR);
for (int i = 1; i < sSearchableAttributes.length; i++) {
ComplexSearchFilter f = authSvc.getSearchFilterInstance(BPMUser.class, sSearchableAttributes, SearchFilter.OPERATOR_EQUAL, "*");
filter.addFilterComponent(f);
I developed a simple web application having a servlet containing this code, it works fine when deployed on the SOA home instance having the parent application as hw_services, but when this application is deployed having the default parent it doesn't create the authSvc variable correctly and returns null.
Is their any configuration files, library jars I am missing here, do i need to upgrade to a new SOA version, please help.Hi,
Please check if the following steps were done:
1. Jar file was deployed to SOA_Oracle_Home\services\lib directory.
2. Jar file was added to the library path. This is done by adding line <library path="SOA_Oracle_Home\bpel\system\services\lib\isplugin.jar"/> to the application.xml file in SOA_Oracle_Home\j2ee\home\config directory.
Regards,
Deepak Suri -
Problems creating file. Can't get resource path.
Hey, I'm new to Java with an Actionscript background and I'm using NetBeans IDE.
Now this comes with my basic lack of understanding for how Java works but I'm getting confused a lot so if someone could just steer me in the right direction I'd be very grateful.
Essentially I'm checking for a config file and if it's not there, I want to create a default one but the paths are messing me up. class.getResource seems to use the src or the build/classes dir? What's the relationship of these? If I put assets in the src folder should they be moved to the build folder or something like that?
The actual problem in code is that if I create a file, (config.xml) and put it in my src folder I can grab it using Main.class.getResource("config.xml"); Which is great but if the file's not there it throws an exception..
Now In actionscript I'd use the File class, which seems very similar to Java's. I'd pass in a literal for the filename "config.xml" and prepend a constant that gives the path of the apps storage directory. If the file's not there then the File.exists property == false.
What I need is to get the same path that getReresource("config.xml") outputs, but in a File and I can't do that with the exception being thrown because the file's not there.
Any help appreciated.. I can't read another blog full of different setups or face another Google page of results pertaining to different problems.
- Chris WRoninStretch wrote:
Essentially I'm checking for a config file and if it's not there, I want to create a default one but the paths are messing me up. class.getResource seems to use the src or the build/classes dir?It looks relative to the classpath, as I recall.
What's the relationship of these? If I put assets in the src folder should they be moved to the build folder or something like that?NetBeans might do that for you. It's a reasonable thing for a build system to do.
You might be better off working without an IDE until you're more familiar with Java.
The actual problem in code is that if I create a file, (config.xml) and put it in my src folder I can grab it using Main.class.getResource("config.xml"); Which is great but if the file's not there it throws an exception..Actually I think getResource will return null if the resource isn't there. Are you not checking for null?
Now In actionscript I'd use the File class, which seems very similar to Java's. I'd pass in a literal for the filename "config.xml" and prepend a constant that gives the path of the apps storage directory. If the file's not there then the File.exists property == false.The Java File object refers to a path on the filesystem, not a virtual one in the manner of Class.getResource. Check the result of getResource to see if it's null.
What I need is to get the same path that getReresource("config.xml") outputs, but in a File and I can't do that with the exception being thrown because the file's not there.Can you show us the actual exception and actual code?
Anyway, if you're packaging all this up in a jar, you wouldn't put the new config.xml that you create in the jar anyway.
More likely you'd do something like:
1) check user's home directory for config.xml
2) if it's not present, check to see if there's a config.xml packaged in your jar.
3) if the user has any config changes, put them in a config.xml in the user's home directory.
So you wouldn't be trying to get the path of the default config.xml anyway.
Or maybe you can use the Preferences framework. -
Getting exe path - JSmoothed my jar
I created an application and I read the path of my jar code like this:
Class cls =myClass.class;
ProtectionDomain domain = cls.getProtectionDomain();
CodeSource source = domain.getCodeSource();
URL url = source.getLocation();
String path=url.toString();
path=path.substring(0,path.lastIndexOf('/'));Let�s suppose my app.jar is located in "C:/Program and Files/mySoftware/bb.jar"
Then, my path returns "C:/Program and Files/mySoftware"
Now I wrapped my jar into .exe file using Jsmooth(yes, I need to do that)
When I run my .exe file it finds a different code location like this:
"C:/Program and Files/tmp/images".
Is there a different way of grabbing the exe path?
Thx!!ThomYork wrote:
Hi again DrLaszlo.
I tried all the previous answers on the thread about the path.
Now that I created a file .exe for my application, I could get its path using
String tmp = System.getProperty("user.dir");
Actually that's how you get the current working directory. Probably you set that to be the directory where the exe was located, but you can't rely on that in general.
Since I was trying to load an image file I had the MalformedURLException when I created
the url using the path.
So, I verify if "tmp" starts with "file:\". If not, I add it and works fine.
if(!tmp.startsWith("file:\\")){
tmp="file:\\"+tmp;
You should use slashes in URLs, not backslashes.
Maybe you are looking for
-
I have a requirement. I want to retrieve a list of all PERNRs corresponding to a particular HR Group entered on the selection screen... I've made use of HOM_GET_HR_SUB_GROUP_PERNR ...On the selection screen i enter a HR group on the basis of it , it
-
Dynamic Image rendering on JSP page
Hi All! I want to display images on my JSP page. However, the images should be generated dynamically (As are used by many sites during the registration process e.g., yahoo, etc..) How can i achieve this? plz help! Its urgent!
-
Autom. replication of EarlyWatch Alerts in 2nd Solution Manager possible?
Hi experts, I just received a question from a customer whether it is possible to automatic replicate EarlyWatch Alerts generated for systems in SolMan A to SolMan B without having all satellite systems connected to SolMan B. There are two reports ava
-
Audio sync problem after saving to QuickTime file
Hi there, I'm relatively new to Adobe Premiere - I'm not quite knowledgeable enough about video editing to really use it to its full potential but needed something more flexible than Windows Movie Maker. I haven't had any problems before editing sma
-
Drawing outline Disappears? (CS5)
Hi, I just upgraded from Flash CS3 to CS5 and when I draw something and try to convert it to a movie clip, duplicate it, etc. the entire drawing's outline just disappears. Am I doing something wrong? Here's an example of what I'm talking about: