Dynamic Directive in Java App

I created a JSP using the dynamic directives based on what is in the Application Development guide of mod_osso. I have the app deployed on a standalone oc4j 9.0.3. It doesn't seem to pick up the getRemoteUser...do I need to deploy in the OHS, or am I missing a requirement here?
Thanks in advance.

Eric, given that mod_osso is an apache module, it is a requirement to use OHS with OC4J.
Thanks.

Similar Messages

  • Open java app and insert text

    Hello All!
    I'm looking for a little help on an exact problem that seems to have been solved here before (but doesn't work for me).
    Here's the original archived thread:
    https://discussions.apple.com/thread/2631967?start=0&tstart=0
    The question asked is exactly the same....
    I have a java app for a Speco Technologies DVR. After opening the app, you must type in a rather long url and then click connect. If you enter the url, then quit the app, when you relaunch it, it does not remember the url that had been entered the previous time.
    I would like to create a script that will launch the Java app and then input the url (text string). I cannot get this to work.
    I've gotten as far as this:
    on run
    tell application "Finder" to activate open document file "DVRVIEWER(DO_NOT_DELETE).jar" of folder "Applications" of startup disk
    delay 5
    set myString to "192.168.0.118"
    repeat with currentCharacter in every character of myString
    tell application "system events"
    keystroke currentCharacter
    end tell
    delay 0.25
    end repeat
    tell application "system events"
    keystroke return
    end run
    AppleScript has a Syntax Error of "Expected end of line, etc. but found command name."
    Does anyone ( taylor.henderson where are you! ) have a fix, or even a better way to do this? Can I edit the existing .jar to have the info directly in there?
    I would actually love to add another section in there that fills in the username and password after entering in the IP address!
    Just for clarification on how this goes:
    Launch .jar.
    Window Launches and prompts for IP address
    Enter in IP address
    Press RETURN
    Windows disappears and new window appears and prompts for username and password
    Enter Username
    Press TAB
    Enter Password
    Press RETURN
    Thank you guys, I'm sure it's easy, but hey, for me Photoshop and Illustrator are a breeze :-0
    -AndyTheFiredog

    Hi
    andythefiredog wrote:
    Is it possible to use similar commands to maximize the java window?
    Yes.
    You must enable the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane
    Add these lines after the last line wich contains "keystroke return"
      delay 2
      tell (first process whose frontmost is true) to click button 2 of window 1 -- zoom
    Here's my test script ( the Speco camera demo), that works without problems here, I use the application "DVRJavaView4.1.jar", this script checks the existence of ui element (more reliable) rather than any delay.
    on run
         do shell script "/usr/bin/open '/Applications/DVRJavaView4.1.jar'"
         tell application "System Events" to tell (first process whose frontmost is true)
              repeat until exists window "Please Input DVR address"
                   delay 1
              end repeat
              keystroke "millapt.ddns.specoddns.net"
              keystroke return
              repeat until exists button "OK" of window 1
                   delay 1 -- wait until the login window is frontmost
              end repeat
              keystroke "user"
              keystroke tab
              delay 0.1
              keystroke "4321"
              delay 0.1
              keystroke return
              repeat until name of window 1 starts with "DVRJavaView"
                   delay 1 --wait while the login window is frontmost
              end repeat
              click button 2 of window 1 -- zoom
         end tell
    end run

  • 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).

  • Problems with WLST embedded in java app.

    Hi,
    I have a problem with the WLST embedded in a java app.
    I want to programatically create or reconfigure a domain from a java application. Following is a simple example of what I want to do.
    import weblogic.management.scripting.utils.WLSTInterpreter;
    public class DomainTester {
      static WLSTInterpreter interpreter = new WLSTInterpreter();
      private void processDomain() {
        if(domainExists()) {
          System.out.println("Should now UPDATE the domain");
        } else {
          System.out.println("Should now CREATE the domain");
      private boolean domainExists() {
        try {
          interpreter.exec("readDomain('d:/myDomains/newDomain')");
          return true;
        }catch(Exception e) {
          return false;
    }The output of this should be one of two possibles.
    1. If the domain exists already it should output
    "Should now UPDATE the domain"
    2. If the domain does not exist it should output
    "Should now CREATE the domain"
    However, if the domain does not exist the output is always :
    Error: readDomain() failed. Do dumpStack() to see details.
    Should now UPDATE the domain
    It never returns false from the domainExists() method therefor always states that the exec() worked.
    It seams that the exec() method does not throw ANY exceptions from the WLST commands. The catch clause is never executed and the return value from domainExists() is always true.
    None of the VERY limited number of examples using embedded WLST in java has exception or error handling in so I need to know what is the policy to detect failures in a WLST command executed in java??? i.e. How does my java application know when a command succeeds or not??
    Regards
    Steve

    Hi,
    I did some creative wrapping for the WLSTInterpreter and I now have very good programatic access to the WLST python commands.
    I will put this on dev2dev somewhere and release it into the open source community.
    Don't know the best place to put it yet, so if anybody sees this and has any good ideas please feel free to pass them on.
    Here is the wrapper class. It can be used as a direct replacement for the weblogic WLSTInterpreter. As I can't overload the actual exec() calls because I want to return a String from this call I created an exec1(String command) that will return a String and throw my WLSTException which is a RuntimeException which you can handle if you like.
    It sets up stderr and stdout streams to interpret the results both from the Python interpreter level and at the JVM level where dumpStack() just seem to do a printStackTrace(). It also calls the dumpStack() command should the result contain this in its text. If either an exception is thrown from the lower level interpreter or dumpStack() is in the response I throw my WLSTException containing this information.
    package eu.medsea.WLST;
    import java.io.ByteArrayOutputStream;
    import java.io.PrintStream;
    import weblogic.management.scripting.utils.WLSTInterpreter;
    public class WLSTInterpreterWrapper extends WLSTInterpreter {
         // For interpreter stdErr and stdOut
         private ByteArrayOutputStream baosErr = new ByteArrayOutputStream();
         private ByteArrayOutputStream baosOut = new ByteArrayOutputStream();
         private PrintStream stdErr = new PrintStream(baosErr);
         private PrintStream stdOut = new PrintStream(baosOut);
         // For redirecting JVM stderr/stdout when calling dumpStack()
         static PrintStream errSaveStream = System.err;
         static PrintStream outSaveStream = System.out;
         public WLSTInterpreterWrapper() {
              setErr(stdErr);
              setOut(stdOut);
         // Wrapper function for the WLSTInterpreter.exec()
         // This will throw an Exception if a failure or exception occures in
         // The WLST command or if the response containes the dumpStack() command
         public String exec1(String command) {
              String output = null;
              try {
                   output = exec2(command);
              }catch(Exception e) {
                   try {
                        synchronized(this) {
                             stdErr.flush();
                             baosErr.reset();
                             e.printStackTrace(stdErr);
                             output = baosErr.toString();
                             baosErr.reset();
                   }catch(Exception ex) {
                        output = null;
                   if(output == null) {
                        throw new WLSTException(e);
                   if(!output.contains(" dumpStack() ")) {
                        // A real exception any way
                        throw new WLSTException(output);
              if (output.length() != 0) {
                   if(output.contains(" dumpStack() ")) {
                        // redirect the JVM stderr for the durration of this next call
                        synchronized(this) {
                             System.setErr(stdErr);
                             System.setOut(stdOut);
                             String _return = exec2("dumpStack()");
                             System.setErr(errSaveStream);
                             System.setOut(outSaveStream);
                             throw new WLSTException(_return);
              return stripCRLF(output);
         private String exec2(String command) {
              // Call down to the interpreter exec method
              exec(command);
              String err = baosErr.toString();
              String out = baosOut.toString();
              if(err.length() == 0 && out.length() == 0) {
                   return "";
              baosErr.reset();
              baosOut.reset();
              StringBuffer buf = new StringBuffer("");
              if (err.length() != 0) {
                   buf.append(err);
              if (out.length() != 0) {
                   buf.append(out);
              return buf.toString();
         // Utility to remove the end of line sequences from the result if any.
         // Many of the response are terminated with either \r or \n or both and
         // some responses can contain more than one of them i.e. \n\r\n
         private String stripCRLF(String line) {
              if(line == null || line.length() == 0) {
                   return line;
              int offset = line.length();          
              while(true && offset > 0) {
                   char c = line.charAt(offset-1);
                   // Check other EOL terminators here
                   if(c == '\r' || c == '\n') {
                        offset--;
                   } else {
                        break;
              return line.substring(0, offset);
    }Next here is the WLSTException class
    package eu.medsea.WLST;
    public class WLSTException extends RuntimeException {
         private static final long serialVersionUID = 1102103857178387601L;
         public WLSTException() {
              super();
         public WLSTException(String message) {
              super(message);
         public WLSTException(Throwable t) {
              super(t);
         public WLSTException(String s, Throwable t) {
              super(s, t);
    }And here is the start of a wrapper class for so that you can use the WLST commands directly. I will flesh this out later with proper var arg capabilities as well as create a whole Exception hierarchy that better suites the calls.
    package eu.medsea.WLST;
    // Provides methods for the WLSTInterpreter
    // just to make life a little easier.
    // Also provides access to the more generic exec(...) call
    public class WLSTCommands {
         public void cd(String path) {
              exec("cd('" + path + "')");
         public void edit() {
              exec("edit()");
         public void startEdit() {
              exec("startEdit()");
         public void save() {
              exec("save()");
         public void activate() {
              exec("activate(block='true')");
         public void updateDomain() {
              exec("updateDomain()");
         public String state(String serverName) {
              return exec("state('" + serverName + "')");
         public String ls(String dir) {
              return exec("ls('" + dir + "')");
         // The generic wrapper for the interpreter exec() call
         public String exec(String command) {
              return interpreter.exec1(command);
         private WLSTInterpreterWrapper interpreter = new WLSTInterpreterWrapper();
    }Lastly here is some example code using these classes:
    its using both the exec(...) and cd(...) wrapper commands from the WLSTCommand.class shown above.
        String machineName = ...; // get name from somewhere
        try {
         exec("machine=create('" + machineName + "','Machine')");
         cd("/Machines/" + machineName + "/NodeManager/" + machineName);
         exec("set('ListenAddress','10.42.60.232')");
         exec("set('ListenPort', 5557)");
        }catch(WLSTException e) {
            // Possibly the machine object already exists so
            // lets just try to look it up.
         exec("machine=lookup('" + machineName + "','Machine')");
    ...After this call a machine object is setup that can be allocated later like so:
         exec("set('Machine',machine)");Regards
    Steve

  • Avaya(Non-java app) integration with ADF

    Hi,
    We have a desktop application Avaya (non-Java) & want to integrate it with ADF. Currently we do it by passing parameters in HTTP URL. If the user clicks on a button in non-java app, it should:
    (1) open search page of an ADF application and execute search.
    (2) if the ADF application is already open, the button on Avaya app should execute search with partial page refresh. However, the whole page is being refreshed.
    Can you please guide, how to do this with partial page refresh? , as the No 1 is almost achieved.
    Thanks,
    NC

    Hi Shay,
    Below Options were tried for integration. Please have a look at them and suggest if there is any other possible way to Integrate Avaya with ADF.
    1) Calling ADF application with URL parameters.
    Reasons to drop:
    Every time a URL is called the entire page will get rendered again taking some 2-3 seconds which is very critical to the application.
    ADF is capable of handling URL parameters without re-loading the whole page(http://oracamp.com/passing-parameters-adf-application-through-url). But we can't use this inbuilt way as we have many customized developments implemented in the page. This way directly works at AMImpl (at Model level) level. We want the events to be fired at View level. That is backing bean level.
    2) Avaya is capable of dealing with ActiveX (OCX). They sent me 2 DLLs which handles communication between web page and Avaya application. A simulator was also sent (bundle attached herewith). The steps to be carried out for testing are-
    Installation procedures:
    i. Register the DTLCRMINT.ocx file. Start->Run-> Type the command
    ii. regsvr32 <ocx file location>
    iii. Register the DTLINTCMP.ocx file. Start->Run-> Type the command
    iv. regsvr32 <ocx file location>
    v. Double click on the Clinet.exe it would open up a windows application with a Textbox and Command button. Put In the data which needs to be sent.
    vi. Open the CRM Page.html. On opening the OCX would be loaded by default.
    vii. Now clicking the Send Data button on the client application, whatever information is there in the Client Text Box would be sent to the web page.
    viii. From CRM side, the application needs to use the OCX provided, and must wait for the event. On receiving the event the data that is retrieved as a part of the event can be parsed to update the text box and click on the search button.
    Reasons to drop:
    It works fine with basic HTML page. But once integrated with ADF page as an inline frame it doesn't work. We tried to embed the OCX object inside <verbatim> tags, but was not successful. The event fired by ActiveX object is triggered at client side by VBScript function. Avaya's ActiveXs seem to be only working with VBScript according to my understanding. So there was no way for ADF to capture VBScript events.
    ADF is capable of javascript up to some extent. To do a critical application like this, my feeling is javascript is never a good option.
    3) To use a text file. Avaya writes, ADF application reads.
    Reasons to drop:
    ADF can read the text files with normal java IO methods. But only the server directories are visible. So, Avaya has to write the information in the server file. With using a parameter like user name, ADF application can read the file in regular time intervals (with using poll feature) and get relevant information and automatically run the search.
    Initially the idea was to do this at client side. But since this is a web application, file reading at client side is next to impossible. Again when one side is reading and the other side is writing, file access violations may occur.
    4) Another option is if Avaya can offer the value in a web service, the ADF application can get it.
    Reasons to drop:
    There may occur a latency as well as Avaya says they can't offer web services.
    5) The ideal solution is, the ADF application's front end control's IDs can be provided. If the Avaya system is capable of accessing or getting hold of DOM and pushing the value to the controls and clicking the button; things would become pretty straight forward. JMeter works like this in testing J2EE applications.
    Any Recommendations how can it be done .
    Thanks.

  • Can java app programmer make secure app?

    I am the author of the Interactive Color Wheel. It (in various versions) has been on the web since 1998, and has been very popular. With the recent hysteria about Java security, I have observed hits fall off dramatically. While it is not commercial and I'm not losing money, the drop-off still concerns me.
    So the question is, until such time as Oracle fixes it, what can I as an app programmer do to alleviate the problem?
    It seems quite ironic that the java app "sandbox", which was supposed to ensure security, seems to be the very source of the current problem. As far as I know, my app:
    * uses the screen
    * accesses the mouse and keyboard
    * accesses resources within its own JAR
    It does not:
    * access the web
    * write/read cookies (or do anything else on the file system)
    With these limitations, is my app even dangerous?

    I'm ignorant concerning the plug-in magic that gives a Java applet a sandbox to run in which protects the rest of the computer (and the world!) from devious programmers. How I view it is the Java Run Time (JRT) does not need a browser plug-in, but the plug-in needs the JRT. That would make them two separate things. If the plug-in for Java 6 releases was safe, why cannot it be packaged with the Java 7 JRT?
    Yes it was a rant -- not really at the whole world, but the journalists and supposed experts they interviewed. And certainly not directed at anyone here! I did not even know there was a problem until I allowed the JRT to upgrade last week, and my app would not run normally any more. At first I blew it off as "the installation screwed up". So I de-installed and re-installed the upgrade several times, and the security block did not go away.
    So I was frustrated but not yet angry. Then during the weekend I got serous about tracing down the problem, and discovered there really was a security issue. From my first question, you can see I still did not understand, thinking that devious internet Voodoo could make my app insecure. If that were the case, how would I block the Voodoo?
    Then I learned here that my applet was not in fact insecure. The press and "experts" were just telling people it (Java in general) was. I don't know what you have read, but there are some ridiculous claims being made. Not just disable Java for the time being (which the browsers are doing automatically now), but that it is inherently unsafe. Completely uninstall it and never re-install. Or the problem is so bad, it will take Oracle two years to fix. I know as a programmer those extreme claims are foolish, and I allowed that to affect me emotionally. I apologize.

  • Accessing repository from a java app

    Hi, I am trying to develop a java app that access a portal repository. I got
    this error message when running the app:
    java.lang.NoClassDefFoundError:
    com/bea/content/manager/i18n/ManagerExceptionTextFormatter
    at
    com.bea.content.manager.internal.RepositoryManagerImpl.<clinit>(RepositoryMa
    nagerImpl.java:31)
    at
    com.bea.content.manager.RepositoryManagerFactory.create(RepositoryManagerFac
    tory.java:22)
    at
    com.bea.content.manager.RepositoryManagerFactory.connect(RepositoryManagerFa
    ctory.java:35)
    Anybody knows where that class is? Perhaps my approach was wrong.
    tia
    panji.a

    Hi Greg, thanks for the confirmation. I think I'm going to access the
    repository values in database directly, bypassing the repository API.
    panji.a
    "Gregory Smith" <[email protected]> wrote in message
    news:[email protected]..
    Whoops, I should have caught this in the first message.
    The repository code is based upon local EJBs, so the api doesn't support
    t3/rmi based access.
    So, to write a non-server based application to access the repository,
    you will need to construct a remoting piece which your application can
    access. One good way would be to create .jws's which access the
    repository code. .jws are WebServices, and I believe you can generate
    client jars for them (I don't know the details about that). But, then
    your client application would communicate via HTTP and SOAP to the .jws,
    which would then communicate to the repository code. If you do this, you
    won't need content_system.jar or wps_system.jar in your app's classpath.
    Greg
    Panji Aryaputra wrote:
    Thanks for the prompt reply. It works, but now I'm getting another error
    message: Repository configuration error
    Looks like I missed something. That error comes from this piece of code:
    RepositoryManagerFactory.connect()
    "Gregory Smith" <[email protected]> wrote in message
    news:[email protected]..
    portal/lib/content_system.jar. You can just add server/lib/weblogic.jar
    and portal/lib/wps_system.jar to your classpath to get most everything
    portal at runtime.

  • Access Java app message loop from ActiveX control running in JNI

    Anyone know how to access a Java application's message loop from inside JNI code?
    Through the (JNIEnv *env) or (jobject obj) parameters maybe?
    I've got an ActiveX dll that I'm running via JNI. The ActiveX dll creates an IP server on a separate thread. When another process connects to the IP server I need to PostMessage (MS Windows term) from this IP server thread to the thread that the Java application is running on.
    It appears the Java application's message loop is not present / available in the JNI code and consequently the message is never posted from the IP thread to the JNI / Java App thread.
    Of course I can manually add a message loop to the JNI code and the PostMessage works just fine. But then the message loop is executing and the Java application is effectively blocked and becomes unresponsive because the JNI method call never returns as its busy running this while loop doing a GetMessage --- DispatchMessage inside the ActiveX dll.
    Maybe JNI is not really intended or this purpose and it's just not possible?
    Thanks.

    Hi Charbs, thanks for the reply.
    I've done a bit more investigation, my application doesn't display any content if I set wmode to direct, even when I try and play a very simple .swf that in no way will be using stage3D.
    I'm now assuming that setting direct wmode forces the .ocx to attempt rendering using Direct3D regardless of whether I use any Stage3D or not.  It would be interesting to find out if it is possible to set wmode to direct, and disable any use of Direct3D, although I suspect that setting wmode to direct would at least use Direct3D as its viewport regardless of any type of display generated by the swf.
    I will investigate the Event.ERROR suggestion, but I'm not a Flash/AS programmer at all, I wouldn't know wher to start so this might take a while - unless any of you helpful souls might knock something up to output/log any error messages from a simple stage3d swf?
    Also, I suspect that how I currently capture the display output and then transfer that to my own Direct3d texture/surface might not be compatible with how direct mode works.  Is there any in depth  technical documentation for how the ocx or projector handle direct wmode?

  • Problem with java app.

    Hi!
    I did not knew where to put this, but, here it goes:
    We have purchased program based on Java (j2re1.4.2_03) and have experienced problems with running other applications like MS office or IE. The problem is that when the Java app is runing, when opening MS word it sometimes freezes. To unfreez MS word wehave to flash open and hide Java app. We and the developers are at loss. What to do?
    PS: if you know the solution or there is another topic about this question pelease write the link. I could not find smoething similar in Google.

    It is not problem in Word. It is not system (Win XP)
    problem. We had system and word reinstalled and
    nothing changed (on several computers). It shows the
    same symptoms. The problem repeats when opening
    Internet explorer where pages have java scripts
    implemented. On word it happens ocasionally.
    Is there at least some direction to point out to our
    developers. Where could be the root of the problem?I am concerned that I should have to tell you what to have the developers to look at. They are the developers after all this is their problem to solve. I don't mean to be trite here but they will know more about what their program does than anyone here will. And if it is a bug in Java then they need to tell you exactly what it is.
    Anyway their are two possible problem sources here I think.
    1) The program interacts with other programs in some way that is detrimental. I have no idea what this program does because you haven't said. But perhaps for example it's using some Office components in some way and making them upset. (This could also possibly explain the IE problem)
    2) The real issue is that the Java program has a bug whereby it consumes all the CPU resources on the system till such time that it is interacted with or otherwise decides to stop behaving that way. This is a bug in the code for the program. Again though other than this not much more can be said because one would have to see the code for the program. I think it's most likely the cause of your problem.
    Last, yes there are bugs in Java itself that can cause problems but not generally in the matter you describe. Again though even if this should turn out to be one of those times it is up to the developers to identify this.
    You need to have the developers solve this for you. This is good as blind direction is going to get I think.

  • Deploying Java Apps to PDAs

    Hi,
    i wanted to know how to deploy Java Apps to PocketPC and Linux-based PDAs.
    can it be done directly frm the toolkit?

    Hi,
    Check if your device supports OTA. If it is supported put your application JAD and JAR file in some webserver and hit the server from your deivce to download the app. Dont forget to set the MIME type of the server

  • OT: Good version control/synchronization program for my Java apps

    Hi,
    I use one of my Java apps on a number of computers in my home, as well as on my work computer. The program is over a meg, but I make changes to it (almost daily) that affect only a few small files. I'd like to find a (preferably free) program that can do something like the following:
    I make a change, then click "update on server." The program sends any modified files (and only modified files) to my web server (whose ftp or ssh information i will have configured in the program).
    Now, when I am on any of computers (which would also have the program I'm looking for installed), I just click "sync to latest version" and it downloads the new files from my server.
    I know Tortoise SVN is supposed to be good for version control, but I can't tell if it can do something like I described above.
    Thanks in advance for any ideas,
    John

    Both Subversion and CVS provide this kind of support. They both have Windows clients that integrate with the Windows file system. For Subversion the commonly used Windows client is Tortoise, for CVS its WinCVS, there are others.
    Subversion is newer and easier to use, but is not supported by as many IDE's as CVS. Eg. JSE8 doesn't support SVN directly, although there is a profile you can install.

  • Kill opened IE, when killing Swing Java App

    I am creating menu items which fire off an IE window to a URL. However, when app is closed the Java process that runs the app blocks waiting for the executed browser to terminate before its shuts itself down. This has potential repercussions as the Java VM hangs around in the mean time, holding resources. Can anyone point me in the direction of how to kill the opened IE window when I kill the java app? I would greatly appreciate any help. :-)
    This is the code in question:
    userManualMenuItem.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
         try
         String url = System.getProperty("EASEUserManualURL");
         Runtime r = Runtime.getRuntime();
         Process p = r.exec("iexplore " + url);
         catch(Exception exception)
              Logger.getLogger().logError("Error opening Intenet Explorer to show EASE user manual.\nCause: " + exception.getMessage());
         });

    Wouldn't it solve the problem if you made the exec() call on a daemon
    thread? I wouldn't advise making exec() calls on the EDT in any case. 1 - You can't call exec() on a Daemon thread. You can call Runtime.exec() inside of a spawned thread that has been marked as a Daemon. This would be preferably rather than launching off of the EventDispatcherThread as itchystratchy stated because....
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
    I'm sure there's a way you can just launch the user's default browser isn't there?2. - I use http://browserlaunch2.sourceforge.net/ in my current app, it launches whatever application you have associated for that file type to view that file. Also supposedly cross platform. You will not get Process reference to the launched app though. I've tested successfully on Win 2000 and XP up to now but it will allow you to close your Java application and leave any launched browsers open if that is what you are looking for or as you asked for earlier keep a collection of launched Process references and destory them when your user is closing your app.

  • NSService for Java App

    Hello,
    I have one Java app name "hill-resort", which registers for a service(NSService) on start. I have written JNI code to receive service request in my running java app. and in my app Info.plist, I have created Service entries. I am passing the file/folder name from mac context menu to my java app using JNI, till now it was working fine, but suddenly it has started giving error like:
    2014-07-19 18:52:56.807 hill-resort[2050:507] Failed to obtain a valid sandbox extension for item: [789514] of flavor: [public.file-url] from the pasteboard.
    2014-07-19 18:52:56.808 hill-resort[2050:507] Failed to get a sandbox extensions for itemIdentifier (789514).  The data for the sandbox extension was NULL
    And it is taking 3 to 10 seconds to get a call in java from the service, earlier it was instantaneous.
    I have google around to find out how to fix it, but haven't find a workable solution for Java app.
    Please help, how to fix it!

    > This is a continuation of a previous issue I've been working on. This
    > falls into the realm of filters, so I thought I'd move it here.
    The same sysops cover all the BM forums, therefore it doesn't matter.
    > I have a
    > java app that needs to connect to the internet. It works fine when I
    > unload ipflt. Using filter debug, it seems as if packets are going out
    > correctly, but are being dropped coming back. I thought, that with dynamic
    > NAT, I wouldn't have to create an inbound exception. Am I off base with that?
    Is the exception you made STATEFUL? If it's not stateful the return
    packets will be dropped.
    Cat
    NSC Volunteer Sysop

  • How do I run multiple java apps in one JVM to reduce memory use?

    Hi all,
    I saw an article either on the web or in a magazine not too long ago about how to "detect" if the app is already running, and if so, it hands off the new instance to the already running JVM, which then creates a thread to run the Java app in. As it turns out, my app will be used in an ASP environment, through Citrix. We may have as many as 50 to 100 users running the same app, each with their own unique user ID, but all using the same one server to run it on. Each instance eats up 25MB of memory right now. So the question is if anybody knows of a URL or an app like this that can handle the process of running the same (or even different Java) apps in one JVM as separate threads, instead of requring several instances of the JVM to run? I know this article presented a fully working example, and I believe I know enough to do it but I wanted ot use the article as a reference to make sure it is done right. I know that each app basically would use the same one "launcher" program that would on first launch "listen" to a port, as well as send a message through the port to see if an existing launcher was running. If it does, it hands off the Java app to be run to the existing luancher application and shuts down the 2nd launching app. By using this method, the JVM eats up its normal memory, but each Java app only consumes its necessary memory as well and doesn't use up more JVM instance memory.
    Thanks.

    <pre>
    import java.util.Properties;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.lang.reflect.Method;
    import java.lang.reflect.InvocationTargetException;
    import java.util.Enumeration;
    import java.util.NoSuchElementException;
    public class RunProg implements Runnable, Cloneable
    private String iProg;
    private String iArgs[];
    public static void main(String args[])
    new RunProg().main();
    // first step is to start main program itself
    private void main()
    Properties properties = System.getProperties();
    try
    properties.load(new FileInputStream("RunProg.properties"));
    catch(IOException e)
    System.setProperties(properties);
    int i = 0;
    System.out.println("enter main, activeCount=" + Thread.activeCount());
    while(true)
    String program = properties.getProperty("Prog" + i);
    if(program == null)
    break;
    StringTokenizer st = new StringTokenizer(program);
    String[] args = new String[st.countTokens() - 1];
    try
    RunProg rp = (RunProg)this.clone();
    rp.iProg = st.nextToken();
    for(int j = 0; st.hasMoreTokens(); j++)
         args[j] = st.nextToken();
    rp.iArgs = args;
    Thread th = new Thread(rp);
    th.setName("prog" + i + "=" + program);
    th.start();
    System.out.println("prog" + i + "=" + program + ", started");
    catch(CloneNotSupportedException e)
    System.out.println("prog" + i + "=" + program + ", can't start");
    i++;
         System.out.println("end of main, activeCount=" + Thread.activeCount());
    // next step is to start all others one by one
    public void run()
    try
    Class c = Class.forName(iProg);
    Class p[] = new Class[1];
    p[0] = String[].class;
    Method m = c.getMethod("main", p);
    Object o[] = new Object[1];
    o[0] = iArgs;
    m.invoke(null, o);
    catch(ClassNotFoundException e)
    System.out.println(iProg + "ClassNotFoundException");
    catch(NoSuchMethodException e)
    System.out.println(iProg + "NoSuchMethodException");
    catch(InvocationTargetException e)
    System.out.println(iProg + "NoSuchMethodException");
    catch(IllegalAccessException e)
    System.out.println(iProg + "NoSuchMethodException");
    System.out.println(Thread.currentThread().getName() + ", ended");
    System.out.println("exit run, activeCount=" + Thread.activeCount());
    // setup SecurityManager to disable method System.exit()
    public RunProg()
         SecurityManager sm = new mySecurityManager();
         System.setSecurityManager(sm);
    // inner-class to disable method System.exit()
    protected class mySecurityManager extends SecurityManager
         public void checkExit(int status)
              super.checkExit(status);
              Thread.currentThread().stop();
              throw new SecurityException();
    * inner-class to analyze StringTokenizer. This class is enhanced to check double Quotation marks
    protected class StringTokenizer implements Enumeration
    private int currentPosition;
    private int maxPosition;
    private String str;
    private String delimiters;
    private boolean retTokens;
    * Constructs a string tokenizer for the specified string. All
    * characters in the <code>delim</code> argument are the delimiters
    * for separating tokens.
    * <p>
    * If the <code>returnTokens</code> flag is <code>true</code>, then
    * the delimiter characters are also returned as tokens. Each
    * delimiter is returned as a string of length one. If the flag is
    * <code>false</code>, the delimiter characters are skipped and only
    * serve as separators between tokens.
    * @param str a string to be parsed.
    * @param delim the delimiters.
    * @param returnTokens flag indicating whether to return the delimiters
    * as tokens.
    public StringTokenizer(String str, String delim, boolean returnTokens)
    currentPosition = 0;
    this.str = str;
    maxPosition = str.length();
    delimiters = delim;
    retTokens = returnTokens;
    * Constructs a string tokenizer for the specified string. The
    * characters in the <code>delim</code> argument are the delimiters
    * for separating tokens. Delimiter characters themselves will not
    * be treated as tokens.
    * @param str a string to be parsed.
    * @param delim the delimiters.
    public StringTokenizer(String str, String delim)
    this(str, delim, false);
    * Constructs a string tokenizer for the specified string. The
    * tokenizer uses the default delimiter set, which is
    * <code>"&#92;t&#92;n&#92;r&#92;f"</code>: the space character, the tab
    * character, the newline character, the carriage-return character,
    * and the form-feed character. Delimiter characters themselves will
    * not be treated as tokens.
    * @param str a string to be parsed.
    public StringTokenizer(String str)
    this(str, " \t\n\r\f", false);
    * Skips delimiters.
    protected void skipDelimiters()
    while(!retTokens &&
    (currentPosition < maxPosition) &&
    (delimiters.indexOf(str.charAt(currentPosition)) >= 0))
    currentPosition++;
    * Tests if there are more tokens available from this tokenizer's string.
    * If this method returns <tt>true</tt>, then a subsequent call to
    * <tt>nextToken</tt> with no argument will successfully return a token.
    * @return <code>true</code> if and only if there is at least one token
    * in the string after the current position; <code>false</code>
    * otherwise.
    public boolean hasMoreTokens()
    skipDelimiters();
    return(currentPosition < maxPosition);
    * Returns the next token from this string tokenizer.
    * @return the next token from this string tokenizer.
    * @exception NoSuchElementException if there are no more tokens in this
    * tokenizer's string.
    public String nextToken()
    skipDelimiters();
    if(currentPosition >= maxPosition)
    throw new NoSuchElementException();
    int start = currentPosition;
    boolean inQuotation = false;
    while((currentPosition < maxPosition) &&
    (delimiters.indexOf(str.charAt(currentPosition)) < 0 || inQuotation))
    if(str.charAt(currentPosition) == '"')
    inQuotation = !inQuotation;
    currentPosition++;
    if(retTokens && (start == currentPosition) &&
    (delimiters.indexOf(str.charAt(currentPosition)) >= 0))
    currentPosition++;
    String s = str.substring(start, currentPosition);
    if(s.charAt(0) == '"')
    s = s.substring(1);
    if(s.charAt(s.length() - 1) == '"')
    s = s.substring(0, s.length() - 1);
    return s;
    * Returns the next token in this string tokenizer's string. First,
    * the set of characters considered to be delimiters by this
    * <tt>StringTokenizer</tt> object is changed to be the characters in
    * the string <tt>delim</tt>. Then the next token in the string
    * after the current position is returned. The current position is
    * advanced beyond the recognized token. The new delimiter set
    * remains the default after this call.
    * @param delim the new delimiters.
    * @return the next token, after switching to the new delimiter set.
    * @exception NoSuchElementException if there are no more tokens in this
    * tokenizer's string.
    public String nextToken(String delim)
    delimiters = delim;
    return nextToken();
    * Returns the same value as the <code>hasMoreTokens</code>
    * method. It exists so that this class can implement the
    * <code>Enumeration</code> interface.
    * @return <code>true</code> if there are more tokens;
    * <code>false</code> otherwise.
    * @see java.util.Enumeration
    * @see java.util.StringTokenizer#hasMoreTokens()
    public boolean hasMoreElements()
    return hasMoreTokens();
    * Returns the same value as the <code>nextToken</code> method,
    * except that its declared return value is <code>Object</code> rather than
    * <code>String</code>. It exists so that this class can implement the
    * <code>Enumeration</code> interface.
    * @return the next token in the string.
    * @exception NoSuchElementException if there are no more tokens in this
    * tokenizer's string.
    * @see java.util.Enumeration
    * @see java.util.StringTokenizer#nextToken()
    public Object nextElement()
    return nextToken();
    * Calculates the number of times that this tokenizer's
    * <code>nextToken</code> method can be called before it generates an
    * exception. The current position is not advanced.
    * @return the number of tokens remaining in the string using the current
    * delimiter set.
    * @see java.util.StringTokenizer#nextToken()
    public int countTokens()
    int count = 0;
    int currpos = currentPosition;
    while(currpos < maxPosition)
    * This is just skipDelimiters(); but it does not affect
    * currentPosition.
    while(!retTokens &&
    (currpos < maxPosition) &&
    (delimiters.indexOf(str.charAt(currpos)) >= 0))
    currpos++;
    if(currpos >= maxPosition)
    break;
    int start = currpos;
    boolean inQuotation = false;
    while((currpos < maxPosition) &&
    (delimiters.indexOf(str.charAt(currpos)) < 0 || inQuotation))
    if(str.charAt(currpos) == '"')
    inQuotation = !inQuotation;
    currpos++;
    if(retTokens && (start == currpos) &&
    (delimiters.indexOf(str.charAt(currpos)) >= 0))
    currpos++;
    count++;
    return count;
    </pre>
    RunProg.properties like this:
    Prog1=GetEnv 47838 837489 892374 839274
    Prog0=GetEnv "djkfds dfkljsd" dsklfj

  • How can i create an dynamic report in Java

    hello everybody,
    I want to make dynamic reports in Java. Report contain data and images with good layout.. such as crystal reports presentation..
    Reports fields decided at run time or we can say that it is generated according to user requirement...
    can it is possible in Java. If it is then which tool is better for it..
    please suggest me.. this is very urgent requirement for me...

    i don't know what types of tools are avaiable in market... Tools for what? You still didn't tell us what exactly you want to do.
    i just imagin that
    "An user create a database dynamically on server
    databaseNobody "dynamically creates a database".
    and he decide reports desgin according to
    his requirement..... we provide an control for this
    type possibilities....."
    so this is question is build in my mind.. so i
    forward this question to this forums..
    I am just going to check the physibility of my mind
    imagination...Feasibility you mean. IMHO, the feasibility of creating that stuff yourself is very low. Reinventing the wheel usually doesn't make it better, and it's likely to be more expensive to pay you for creating an inferior solution (not because of lack of skills, but simply because the available products had a few years time to grow, feature-wise) than to simply buy the licenses. Look at Crystal Reports or JFreeChart or Jasper Reports. Or use Google to look up J2EE-based reporting libraries. There might be more.
    Which of these is best, I don't know, I never used any of those. Also, the definition of "best" changes with the requirements. What's better, a Ferrari or a truck?

Maybe you are looking for