Access class' properties (in _root) from movieclip timeline?

I'm trying to follow the advice "class properties are better
then _global variables", but how could I access a class' properties
(imported in the main timeline) from a movie Clip timeline?
this code in the main timeline works (and trace the value of
lang):
import scripts.StartupSettings
trace (StartupSettings.lang);
but if I try to access the lang property from a movie clip
timeline, with the same:
trace (StartupSettings.lang);
I get traced "undefined".
The only workaround I have found is to import again the class
inside the clip, but I would like to avoid it in order to keep
dimensions small.
Any idea? thanks

The import statement doesn't really import anything. It's
used to not have to call a method using the fully qualified class
name. So, don't worry about 'dimensions'. And, the import statement
is only 'valid' on the frame it is defined on. On another frame,
you have to use the import statement again.

Similar Messages

  • Problem Accessing Class in my package from jsp file

    Hi,
    I am using Apache tomcat server and i have made package which contains a class for database connection. I have imported this package in my jsp file but when i run the jsp tomcat gives the class not found exception. i have placed the jsp file in /webapps/my_project/ folder and the package in the /webapps/my_project/WEB-INF/classes/ folder.
    Still its not working.
    Please help me out!!!!!!!!

    hi,
    Thanks for ur reply. You have guessed it right, i dont have a .jar file its a .class file in a package subfolder. I have tried out ur suggestion but it didnt work. The following error i shown when i run it.
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    C:\Apache Tomcat 4.0\work\localhost\_\College\test$jsp.java:4: Package college_lib not found in import.
    import college_lib.*;
    ^
    1 error, 1 warning
    Here, College_lib is the package name which contains the class my class file
    Is there any problem with my Apache Tomcat4.0 or any other thing.
    Message was edited by:
    Despo

  • Access Class in Default Package

    Make long story short, I have to have some class in the "(default package)", related to JNI, and I will need to pass data back and forth from and to these classes from some packaged classes. I am using Java 1.4. As I know since Java 1.4, it's not possible to access classes in default package from packaged classes directly. Is there a work around? please help...

    I DON'T have the C/C++ codeSo you have to do with the "old" classes in the default package.
    Then use jschell's suggestion to devise proxying code that allow bridging between the packages.
    since Java 1.4, I can't call the java class in the default package from packaged class any moreIf I understand jschell's post, this restriction is enforced by the Java compiler , not by the Java interpreter (JVM). Indeed this is specified in the JLS (Java Language Specifications, http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5), not the JVM specifications (I have not verified that latter point).
    So if you get an older JDK (before 1.4 they would accept the construct), you can try writing proxy classes within a named package, proxying to the old classes in the unnamed package. Once they are compiled, and jarred together for convenience, you can switch back to the current compiler (let's says 1.6) to compile the rest of your application classes, which only use the classes in the named package, using the jar as a library.
    When executing the program, the JVM will execute everything without complaining, since it supports execution of compiled code that has been compiled with former versions.

  • Navigating the Timeline from Movieclip

    Hi there
    I'm hoping someone can help me with this. I have created a
    scrolling image gallery in Flash which works fine from the Timeline
    (Scene 1). Now I am using it inside a movie clip called gallery I
    need to know how to get it to load the images into the main loading
    area now that it is within a movie clip. The code that makes the
    images load into the loading area at the moment is this
    on(press){
    _root.the_entire_gallery.gotoAndPlay("pic5");
    I'm assuming that now it is inside a movie clip I need to add
    something other than _root. to get it to access the images but I
    don't know what. I've tried _parent but to be honest I'm clutching
    at straws as I don't really understand what it does.
    Hope someone can help.
    Thanks

    Hi there
    I have tried both the solutions you suggested without any
    luck. Is there a way I can send you a copy of the fla and you will
    be able to see how it is set up?
    Perhaps a simpler example is the button inside the gallery
    movieclip, this doesn't work from inside here either it has the
    following code on it ...
    on (press) {
    _root.gotoAndStop("sketchbook");
    ...that let's it work from the main timeline but now that the
    frame label "sketchbook" is inside the gallery movieclip how do I
    get it to reference that because nothing is happening as I take it
    _root. is pointing it to the main timeline?
    I have tried on (press) { gallery.gotoAndStop("sketchbook");
    I know it all works if I don't put it into a movieclip but I
    want to have everything neat and tidy on the timeline. It would
    really help to be able to send you the fla.
    Thanks, Jo

  • Urgent: how to really seperate business logic class from data access class

    Hello,
    I've this problem here on my hand and i really need help urgently. so please allow me to thank anyone who replies to this thread =)
    Before i go any futhur, let me present a scenario. this will help make my question clearer.
    "A user choose to view his account information"
    here, i've attempted to do the following. i've tried to seperate my application into 3 layers, the GUI layer, the business logic layer, and the data access layer.
    classically, the GUI layer only knows which object it should invoke, for example in the case above, the GUI would instantiate an Account object and prob the displayAcctInfo method of the Account object.
    here is how my Account class looks like:
    public class Account
    private acctNo;
    private userid;
    private password;
    private Customer acctOwner;
    the way this class is being modelled is that there is a handle to a customer object.
    that being the case, when i want to retrieve back account information, how do i go about retrieveing the information on the customer? should my data access class have knowledge on how the customer is being programmed? ie setName, getName, setAge, getAge all these methods etc? if not, how do i restore the state of the Customer object nested inside?
    is there a better way to archieve the solution to my problem above? i would appriciate it for any help rendered =)
    Yours sincerely,
    Javier

    public class AccountThat looks like a business layer object to me.
    In a large application the GUI probably shouldn't ever touch business objects. It makes requests to the business layer for specific information. For example you might have a class called CustomerAccountSummary - the data for that might come entirely from the Account object or it might come from Account and Customer.
    When the GUI requests information it receives it as a 'primitive' - which is a class that has no behaviour (methods), just data. This keeps the interface between the GUI and business layer simple and makes it easier to maintain.
    When using a primitive there are four operations: query, create, update and delete.
    For a query the gui sets only the attributes in the primitive that will be specifically queried for (or a specialized primitive can be created for this.) The result of a query is either a single primitive or a collection of primitives. Each primitive will have all the attributes defined.
    For a create all of the attributes are set. The gui calls a method and passes the primtive.
    For an update, usually all fields are defined although this can vary. The gui calls a method and passes the primitive.
    For a delete, only the 'key' fields are set (more can be but they are not used.) The gui calls a method and passes the primitive.
    Also keep in mind that a clean seperation is always an idealization. For example verify that duplicate records are not created is a business logic requirement (the database doesn't care.) However, it is much easier and more efficient to handle that rule in the database rather than in the business layer.

  • Moving to a frame in Movieclip timeline from the main timeline

    I am in the learning process. Working with FlashCS5 and AS3.
    Please bear with me if the issue appears to be too simple for you. Placed a movieclip(mcassessJohn) on the main timeline and moved to the frame labelled "johnFeedback" in the movieclip timeline using the following actionscript code.
    mcassessJohn.addEventListener(MouseEvent.CLICK, onJohnClick);
    function onJohnClick(evt:MouseEvent):void {
       mcassessJohn.gotoAndPlay("johnFeedback");
    This works fine. However problem starts when I place a button "questionJohn" in the movieclip(mcassessJohn) time line at frame "johnFeedback" and try to move to another frame by clicking the button and using the following actionscript code;
    questionJohn.addEventListener(MouseEventClick,onClick);
    function onClick(evt:MouseEvent):void {
      gotoAnd Play("johnFeedback");
    Placed the above code in actions layer in the movieclip timeline at frame "johnFeedback". I had placed the button also in the movieclip timeline at Frame "johnFeedback in layer buttons. No compiler error.No runtime error. Just nothing happens when I click on the button "questionJohn".
    Would appreciate if you can let me know where I am going wrong.

    Thats because if u assign the listeners to a parent movieclip it will not pickup listener assigned to its child.
    A work around is put a invisible btn inside mcassessJohn movieclip on frame 1 and assign onJohnClick function to that.
    And one more thing, i think u r trying to perform same operation on both the btns
    http://www.darshanrane.com

  • Accessing buttons on main stage from inside of a movie clip

    Greetings...
          here is the scenario:
                 - I have buttons on main stage, and a swf file which is loaded to scene using a LOADER in AS3
                 - this is a website, so the problem rises when user moves its cursor around the page and now  buttons in main stage,
                    are still active since they are behind the loaded swf file.
                 - i would like to learn, how can i CODE inside the loaded SWF file, to either remove the buttons in main page, or remove
                    the event listeners. not sure if my case has anything to do with .Parent or .roo, (I want to access those main stage
                    buttons from the SWF file which is loaded)
                 - The general case is, i have SWF files loading inside another SWF files, is it possible to access items on each stage from
                    inside of loaded SWF files on that specific stage. Similarly i would be interested to learn about accessing main stage from inside
                    of movieclips running on stage. how can i access something not in present FLA file yet, in FLA file that is loading the page as SWF.
                    Thanks.

    If you load an swf into another using the Loader class, then the Loader itself is the parent of the loaded swf., so MovieClip(parent.parent) might help you to target the timeline that the Loader was born from.  The more proper way to have a loaded file talk to a parent file is thru dispatching events that the parent assigns listeners for after the file has loaded.  Here's a link to a posting that might help explain how to implement this.
    http://forums.adobe.com/thread/470135?tstart=120
    As for the buttons that you want to disable, you could either use the removeEventListener() method to remove the listeners you have assigned, or you could set their mouseEnabled property to false, or you could set their visible property to false.

  • Cannot access class oracle.jheadstart.model.adfbc.JhsApplicationModuleImpl;

    Error(2,38): cannot access class oracle.jheadstart.model.adfbc.JhsApplicationModuleImpl; file oracle\jheadstart\model\adfbc\JhsApplicationModuleImpl.class not found
    Hi,
    I am working on demo application from JHeadstart Developer's Guide (ch2). I got the above error when I tried to test the ADF BC.
    I checked the Project properties of the model and there was no jheadstart subfolder under oracle folder.
    I followed the install.html for JHeadstart download without problem.
    I am wondering if the .jar files from JHeadstart that I copied to Jdeveloper is where the issue is?
    Any help is much appreciated.
    Ahsan

    Sandra,
    Thanks for your prompt and helpful response.
    When you are at page 2-9 in the Getting Started chapter, you should not have run the Application Generator yet, therefore your Application Module should not extend JhsApplicationModuleImpl yet.
    CORRECT.
    Or did you explicitly set the ADF BC Base Class properties to JhsApplicationModuleImpl?
    YES I DID THIS.
    The paragraph that describes this does mention that JHeadstart sets it up for you, you don't have to do it yourself. Is that where the confusion originated?
    YES I UNDERSTOOD THIS ALSO BUT THE CONFUSION WAS NOT HERE.
    MY SUGGESTION: if you modified the first sentence on page 2-10 to something like (You need to 'run the JAG' before you do Right-click the "HRService"Application Module and choose 'Test' 'otherwise you will get an error') would resolve the confusion for me.

  • Can't access class files in jar file

    I'm running Eclipse and trying to access class files in a jar file from source. I have added the jar file through Properties/Java Build Path/Add External JARs... but the class files are not visible from my source code. Any ideas what is happening?
    Thanks!

    Depends what you mean by "visible." Are you getting a ClassNotFoundException? If so, your JAR isn't in your runtime CLASSPATH. You should be able to solve that (in Eclipse) by by modifying your project classpath.
    If "visible" means your code is usng a ZIP class to peek inside the JAR & it's not working, best bet is to re-study the ZIP class Javadocs & examine the error messages carefully.
    If this doesn't solve the problem, please provide more details & the specific error message/stack trace you're getting.

  • TypeError: Error #2022: Class DS0$ must inherit from DisplayObject to link to a symbol

    Hello,
    When I tried AIR 3.7.0.1410 (ASC 2.0) to make an instance of a class that has AS linkage compiled as swc by Flash Pro,  it fails on
    TypeError: Error #2022: Class DS0$ must inherit from DisplayObject to link to a symbol
    at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at flash.display::MovieClip()
        at flash.display::Sprite/constructChildren()
        at flash.display::Sprite()
        at (AS-linkaged class name)
    while it's OK with AIR 3.6.0.6090.
    I'm on Windows 7 and Flash Builder 4.7. Does anyone see this issue?
    As for bug I put it here (Bug 3520793)
    https://bugbase.adobe.com/index.cfm?event=bug&id=3520793

    Hi Colin,
    Can you show me how you're embedding the asset in ASC 2.0?
    In Flash Pro, I imported a wav file into my library, configured the sound's linkage properties to export the asset, using the class name "ding". I then published the project as a .swc.
    In Flash Builder 4.7 Beta 1 (updated to ASC 2.0 Preview 3, though I don't think this is necessary for this particular test case), I created a new ActionScript Project, added the swc to my project library path, and then instantiated an instance of ding and played it. It seemed to work fine:
    package
        import flash.display.Sprite;
        import flash.media.Sound;
        public class SoundTest extends Sprite
            public function SoundTest()
                var s:Sound = new ding();
                s.play(0, 10);

  • Accessing RS232 Port (Comm Port) from Applet

    I have an interesting "problem". I would like to create an applet that allows me to read the Comm port of the client machine but obviously I get a security exception when I try to do this. Firstly is this possible (I know it can be done from an application)? If so, how would I go about doing it?
    Thanks,
    Rishi

    you need to install the jre, and place the win32.dll at JavaSoft\JRE\1.3.1_06\bin, that properties file place at JavaSoft\JRE\1.3.1_06\lib, comm.jar at JavaSoft\JRE\1.3.1_06\lib\ext\
    and in ur code try to use it to open ur com port
    public String test() {
              String drivername = "com.sun.comm.Win32Driver";
              try
                   CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
              catch (Throwable th)
                   {* Discard it */}
              drivername = "javax.comm.*";
              try
                   CommDriver driver = (CommDriver) Class.forName(drivername).newInstance(); driver.initialize();
              catch (Throwable th)
                   {* Discard it */}
    portList = CommPortIdentifier.getPortIdentifiers();
    while (portList.hasMoreElements()) {
    portId = (CommPortIdentifier) portList.nextElement();
    if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    if (portId.getName().equals("COM2")) {
    //if (portId.getName().equals("/dev/term/a")) {
    try {
    serialPort = (SerialPort)
    portId.open("SimpleWriteApp", 2000);
    } catch (PortInUseException e) {}
    try {
    outputStream = serialPort.getOutputStream();
    } catch (IOException e) {}
    try {
    serialPort.setSerialPortParams(9600,
    SerialPort.DATABITS_8,
    SerialPort.STOPBITS_1,
    SerialPort.PARITY_NONE);
    } catch (UnsupportedCommOperationException e) {}
                             int i=0;
                             while(true)
         try {
                                       messageString="hi";
                                       System.out.println(i++);
         outputStream.write(messageString.getBytes());
         } catch (IOException e)
                                       System.out.println(e);
                                       messageString=String.valueOf(e);
              return messageString;
    and yet u need to signed the applet
    1.     Compile the applet
    2.     Create a JAR file
    3.     Generate Keys
    4.     Sign the JAR file
    5.     Export the Public Key Certificate
    6.     Import the Certificate as a Trusted Certificate
    7.     Create the policy file
    8.     Run the applet
    Susan
    Susan bundles the applet executable in a JAR file, signs the JAR file, and exports the public key certificate.
    1.     Compile the Applet
    In her working directory, Susan uses the javac command to compile the SignedAppletDemo.java class. The output from the javac command is the SignedAppletDemo.class.
    javac SignedAppletDemo.java
    2.     Make a JAR File
    Susan then makes the compiled SignedAppletDemo.class file into a JAR file. The -cvf option to the jar command creates a new archive (c), using verbose mode (v), and specifies the archive file name (f). The archive file name is SignedApplet.jar.
    jar cvf SignedApplet.jar SignedAppletDemo.class
    3.     Generate Keys
    Susan creates a keystore database named susanstore that has an entry for a newly generated public and private key pair with the public key in a certificate. A JAR file is signed with the private key of the creator of the JAR file and the signature is verified by the recipient of the JAR file with the public key in the pair. The certificate is a statement from the owner of the private key that the public key in the pair has a particular value so the person using the public key can be assured the public key is authentic. Public and private keys must already exist in the keystore database before jarsigner can be used to sign or verify the signature on a JAR file.
    In her working directory, Susan creates a keystore database and generates the keys:
    keytool -genkey -alias signFiles -keystore susanstore -keypass kpi135 -dname "cn=jones" -storepass ab987c
    This keytool -genkey command invocation generates a key pair that is identified by the alias signFiles. Subsequent keytool command invocations use this alias and the key password (-keypass kpi135) to access the private key in the generated pair.
    The generated key pair is stored in a keystore database called susanstore (-keystore susanstore) in the current directory, and accessed with the susanstore password (-storepass ab987c).
    The -dname "cn=jones" option specifies an X.500 Distinguished Name with a commonName (cn) value. X.500 Distinguished Names identify entities for X.509 certificates.
    You can view all keytool options and parameters by typing:
    keytool -help
    4.     Sign the JAR File
    JAR Signer is a command line tool for signing and verifying the signature on JAR files. In her working directory, Susan uses jarsigner to make a signed copy of the SignedApplet.jar file.
    jarsigner -keystore susanstore -storepass ab987c -keypass kpi135 -signedjar SSignedApplet.jar SignedApplet.jar signFiles
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5.     Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    The -storepass ab987c and -keystore susanstore options specify the keystore database and password where the private key for signing the JAR file is stored. The -keypass kpi135 option is the password to the private key, SSignedApplet.jar is the name of the signed JAR file, and signFiles is the alias to the private key. jarsigner extracts the certificate from the keystore whose entry is signFiles and attaches it to the generated signature of the signed JAR file.
    5: Export the Public Key Certificate
    The public key certificate is sent with the JAR file to the whoever is going to use the applet. That person uses the certificate to authenticate the signature on the JAR file. To send a certificate, you have to first export it.
    In her working directory, Susan uses keytool to copy the certificate from susanstore to a file named SusanJones.cer as follows:
    keytool -export -keystore susanstore -storepass ab987c -alias signFiles -file SusanJones.cer
    Ray
    Ray receives the JAR file from Susan, imports the certificate, creates a policy file granting the applet access, and runs the applet.
    6.     Import Certificate as a Trusted Certificate
    Ray has received SSignedApplet.jar and SusanJones.cer from Susan. He puts them in his home directory. Ray must now create a keystore database (raystore) and import the certificate into it. Ray uses keytool in his home directory /home/ray to import the certificate:
    keytool -import -alias susan -file SusanJones.cer -keystore raystore -storepass abcdefgh
    7.     Create the Policy File
    The policy file grants the SSignedApplet.jar file signed by the alias susan permission to create newfile (and no other file) in the user's home directory.
    Ray creates the policy file in his home directory using either policytool or an ASCII editor.
    keystore "/home/ray/raystore";
    // A sample policy file that lets a JavaTM program
    // create newfile in user's home directory
    // Satya N Dodda
    grant SignedBy "susan"
         permission java.security.AllPermission;
    8.     Run the Applet in Applet Viewer
    Applet Viewer connects to the HTML documents and resources specified in the call to appletviewer, and displays the applet in its own window. To run the example, Ray copies the signed JAR file and HTML file to /home/aURL/public_html and invokes Applet viewer from his home directory as follows:
    Html code :
    </body>
    </html>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    width="600" height="400" align="middle"
    codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,1,2">
    <PARAM NAME="code" VALUE="SignedAppletDemo.class">
    <PARAM NAME="archive" VALUE="SSignedApplet.jar">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
    </OBJECT>
    </body>
    </html>
    appletviewer -J-Djava.security.policy=Write.jp
    http://aURL.com/SignedApplet.html
    Note: Type everything on one line and put a space after Write.jp
    The -J-Djava.security.policy=Write.jp option tells Applet Viewer to run the applet referenced in the SignedApplet.html file with the Write.jp policy file.
    Note: The Policy file can be stored on a server and specified in the appletviewer invocation as a URL.
    9.     Run the Applet in Browser
    Download JRE 1.3 from Javasoft
    good luck! [email protected]
    i already give u many tips, i use 2 weeks to try this to success, hopw that u understand that, a result of success is not important, the process of how to get things done is most usefull!

  • Unable to access class methods

    I have this class linked to a movieclip. I am attemping to
    access navPanelClose() from another class in the same package but
    get the error:
    1061: Call to a possibly undefined method navPanelClose
    through a reference with static type Class.
    Here is the Class:
    package classes.util{
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    public class NavInstructions extends MovieClip {
    private var _timer:Timer;
    public function NavInstructions() {
    Glo.bal.navPanel = this;
    public function navPanelClose() {
    _timer = new Timer(30);
    _timer.addEventListener("timer", easeToLoc(722,379.8));
    _timer.start();
    public function navPanelOpen() {
    _timer = new Timer(30);
    _timer.addEventListener("timer", easeToLoc(722, 285.5));
    _timer.start();
    private function easeToLoc(targetX:Number,targetY:Number) {
    var _easingSpeed:Number = 0.1;
    var dx:Number = targetX - this.x;
    var dy:Number = targetY - this.y;
    var dist:Number = Math.sqrt(dx * dx + dy * dy);
    if (dist < 1) {
    this.x = targetX;
    this.y = targetY;
    _timer.stop();
    _timer.removeEventListener("timer", easeToLoc);
    } else {
    this.x += dx * _easingSpeed;
    this.y += dy * _easingSpeed;
    What am I missing here?

    quote:
    Please help me understand why. I have the easeToLoc setup to
    received input variables:
    The syntax of ActionScript dictates that you refer to the
    callback function in the way that I pointed out. The only argument
    that is passed to that listener function is an event object. This
    is what it expects, nothing more. Take a look at the
    docs
    for more info, specifically the categories under Programming
    ActionScript 3.0 -> Handling Events.
    Looking at navPanelClose() and navPanelOpen(), the values
    you're trying to pass seem more like constants to me, not
    variables. So why not declare them as constants within this class
    and refer to them as such within easeToLoc()? If you truly want to
    use variables, perhaps creating a separate utility class to handle
    this logic will work better.
    When trying to access a method within one class from another
    ...let's say you want to access myMethod() within class MyAClass
    from class MyBClass. You could:
    1. Declare myMethod() as static and then refer to it from
    anywhere after importing MyAClass. So you can call
    MyAClass.myMethod() without having to instantiate MyAClass. This is
    what you're trying to do here, I think.
    2. Have class MyBClass extend MyAClass where myMethod() is
    public or protected and MyBClass is in the same package as MyAClass
    when it's declared as protected. For this to work you'd have to
    instantiate MyBClass.
    TS

  • Access log4j.properties outside source folder

    Hi,
    I have developed a standalone java application, for logging the application i have created a log4j.properties in the source folder.
    it is woring fine and the logs are created as specified in the properties file.
    Issue:
    i have created a jar which contains the complete source code and log4j.properties file.
    if i try to create a jar without log4j.properties since the properties file will change by customer frequantly, i need to keep the log4j.properties outside the source folder.
    but my jar is unable to access the log4j.properties when i try to run the appplication.
    Question:
    how do we access the log4j.properties from outside source folder?
    thanks,
    J R

    gimbal2 wrote:
    T.PD wrote:
    In addition what gimbal2 sad: Do you create a MANIFEST.MF file in your jar?
    If so you should add (or extend) the ClassPath entry to include the current directory ( *.* ) so you can have the log4j.properties file in the folder where you call your jar from:[...]This is very dangerous. It makes the path not relative to where the jar is, but to where you invoke the java command.The OP's request is to have the (log4j) properties file outside of the jar maybe for easier editing.
    Adding any known folder in the file system to the class path is the only way I know to achieve this (Do you know better?). Folliwing this you could try to guess paths to add hoping that they will exist on all Systems you will use and place the properties file(s) there. On the other hane the current working dir the java command is invoked in is perdictable. Usually it's the directory the jar itself is located...
    I agree that this solution can be dangerous and opens the possibility to access classes located in a valid package structure below current working dir . But if you add the ' *.* ' as the last entry in your classpath at least the classes from all your other jars are accessed first...
    bye
    TPD

  • HOw to access ApplicationResource.properties file using getSystemResource

    I am using struts. I need to access ApplicationResource.properties file, which I define my connection String there. All my methods are static method, so I cannot use getResourceAsStream() method from ClassLoader class, so i have to use getSystemResourceAsStream() method. However, I always get class not found error. Inputstream is always null.
    my ApplicationResource.properties file is stored in projectname/classes, and all my other classes store in projectname/classes/com/testname/. Can anybody tell me how to make it work? Thank you in advance.
    Here is my code:
    private static String getConnectionURL() throws FileNotFoundException,IOException,ClassNotFoundException
    Properties properties = new Properties();
    InputStream fromFile = ClassLoader.getSystemResourceAsStream("ApplicationResources.properties");
    if (fromFile !=null)
    properties.load(fromFile);
    String connectionURL = properties.getProperty("progressiveURL");
    return connectionURL;
    }

    Try either:
    ClassLoader.getSystemResourceAsStream("/ApplicationResources.properties");
    or
    YourClass.class.getResourceAsStream("/ApplicationResources.properties");
    in either case, you need to add the "/" prefix.

  • Error when trying to access a secured web service from Forms 10g 10.1.2.3

    Hello,
    I'm trying to access a secured web service from Forms10g 10.1.2.3 but i'm getting the next error when pressing the button the first time:
    java.rmi.RemoteException: ; nested exception is: HTTP transport error: javax.xml.soap.SOAPException:
    java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 401 UnauthorizeWhen i press the button a second time i got this error:
    javax.xml.rpc.soap.SOAPFaultException: The SOAP request is invalid. The required node 'Envelope' is missingThis is the code i have in my button:
    DECLARE
    jo ora_java.jobject;
    pdfObject ora_java.jobject;
    pdf     varchar2(900);
    rv varchar2(100);
    ex ora_java.jobject;
    BEGIN
    JO := SEARCHSOAPCLIENT.new;
    SEARCHSOAPCLIENT.setUsername(JO,'weblogic');
    SEARCHSOAPCLIENT.setPassword(JO,'welcome1');
    pdfObject := SEARCHSOAPCLIENT.quicksearch(JO,'1234',NULL);
    pdf := SEARCHSOAPCLIENT.tostring(pdfObject);
    message(pdf);
    message(' ');
    EXCEPTION
    WHEN ORA_JAVA.JAVA_ERROR then
    message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
    WHEN ORA_JAVA.EXCEPTION_THROWN then
    ex := ORA_JAVA.LAST_EXCEPTION;
    :error := Exception_.toString(ex);
    END;When i run it from JDeveloper it works, this is a portion of java code the proxy web service has:
    import oracle.webservices.transport.ClientTransport;
    import oracle.webservices.OracleStub;
    import javax.xml.rpc.ServiceFactory;
    import javax.xml.rpc.Stub;
    public class SearchSoapClient {
        private webservicesproxywebcontent.proxy.SearchSoap _port;
        public SearchSoapClient() throws Exception {
            ServiceFactory factory = ServiceFactory.newInstance();
            _port = ((webservicesproxywebcontent.proxy.Search)factory.loadService(webservicesproxywebcontent.proxy.Search.class)).getSearchSoap();
            this.setUsername("weblogic");
            this.setPassword("welcome1");
            System.out.println("callling from _port "+ _port.quickSearch("1234234", null));
         * @param args
        public static void main(String[] args) {
            try {
                webservicesproxywebcontent.proxy.SearchSoapClient myPort = new webservicesproxywebcontent.proxy.SearchSoapClient();
                System.out.println("calling " + myPort.getEndpoint());
            } catch (Exception ex) {
                ex.printStackTrace();
         * delegate all operations to the underlying implementation class.
        public QuickSearchResult quickSearch(String queryText, IdcPropertyList extraProps) throws java.rmi.RemoteException {
            return _port.quickSearch(queryText, extraProps);
        }Also the secured web service was generated from Webcenter Content 11.1.1.6 that is why it's a secured web service.
    Kind Regards
    Carlos

    Without going into any technical discussion about the code, my first question is what JDK version was used to create this which was imported into the form? Understand that Forms 10 runs on JDK 1.4.2, so if you used any newer JDK version, likely there will be problems.

Maybe you are looking for