Can i give a process name of executing java class

hi all,
what i need is when i execute the class file using java at the command prompt i want to create a separate process of that class. that means when i execute this class i want 2 processes running one is "java" and the other is "The Class To be executed".
is it possible????
actually my requirement is that i want only one instance of my class can run at a time.
please help me
thanks
bye

hi
actually i can not use the file lock because my application is going to run on Solaris machine and since its a mutiuser platform and every user has a limited access to his data.and any user can run my application so the problem is where one user will write into a file so that other user can also read from the same file.
can i do it other way using native methods if yes can u elaborate please
thanks
bye

Similar Messages

  • Can I give a process higher priority over another?

    is there anyway that I can give a process higher priority over others? I'd like to give one of my programs higher priority so that it responds quicker to when my RF remote is pressed.

    Open the Terminal.app in /Applications/Utilities/, type this into the window that pops up, and hit the return key, hit the space bar to scroll down until you get an (END) prompt, hit the Q key, and then read all about the command:
    *man nice*

  • Can I give pages custom names?

    So I know this is probably a long shot, but I was wondering if there is a way to give pages custom names.  For example - if I'm doing a data merge, is there a way to name the pages using a data field?  Like if each page is a reocrd of a person, can I use the "Last Name" field to automatically name each page? Any help or suggestions would be super appreciated!  Thank you!
    Katey

    I was going to say no, becasue you can't name document pages, only masters, but I'm not really sure where you want the name, so maybe there's something you can do that will suffice. If you want the name to appear in a header or footer, for example you could jut add another placeholder for that field, or use a variable on the master page, perhaps.

  • Unable to execute java class.

    HI !
    I have got a very weird problem .I have wrritten a simple java program Hello world using Weblogic workshop.As required I'm saving this file in the package folder and executing it .I have set the home directories properly .My code is :
    package java1;
    public class hello
    public static void main(String[] args)
    System.out.println("Hello World");
    After I compile I get the foolowing in the o/p window :
    Trying to attach to 3218...
    Starting process in C:\bea\myprojects
    C:\bea\jdk141_02\bin\javaw.exe -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=3218,suspend=y,server=y -classpath myprojects.proj1.java1.hello
    Usage: javaw [-options] class [args...]
    (to execute a class)
    or javaw -jar [-options] jarfile [args...]
    (to execute a jar file)
    where options include:
    -client     to select the "client" VM
    -server     to select the "server" VM
    -hotspot     is a synonym for the "client" VM [deprecated]
    The default VM is client.
    -cp -classpath <directories and zip/jar files separated by ;>
    set search path for application classes and resources
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version and exit
    -showversion print product version and continue
    -? -help print this help message
    -X print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
    enable assertions
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
    disable assertions
    -esa | -enablesystemassertions
    enable system assertions
    -dsa | -disablesystemassertions
    disable system assertions
    I dont know what to do ? Do I have to set any paths or any thing ? It is not required to set the class path here.
    Please Help.
    Thanks in advance.

    try to compile your programm from command prompt
    change dir to hello.java directory
    to compile programm type:
    javac hello.java
    if it will compile successfully run it by typing
    java hello
    if it will not be helpfull uninstall JDK 1.4 and instal JDK again. I'd recomend JDK 1.5.

  • Problem while trying to execute Java class in JSP using  RunTime Class

    Hi,
    I want to execute a JAVA class through a JSP. For this I am using following code ....
    JSP (AAA.jsp) CODE ............
    try
    String[] cmd = new String[3];
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[2] = "java -DPeBS_CONFIG_HOME=D:/CASLIntegration/PeBS/srcvob/PeBS/config Service_Statement_Application 22/May/2001 22/May/2003";
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1] + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    catch (Throwable t)
    t.printStackTrace();
    StreamGobbler THread class Code ..........
    import java.util.*;
    import java.io.*;
    public class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    I have successfully compiled and placed the class file for the above class in JSP's servlet engine. However, when I execute the JSP through explorer Web Browser, I get following compile time error:
    An error occurred between lines: 36 and 86 in the jsp file: /casl/LocalApp/VehicleServiceStmt/AAA.jsp
    Generated servlet error:
    D:\Tomcat\work\localhost\_\casl\LocalApp\VehicleServiceStmt\AAA$jsp.java:118: No constructor matching StreamGobbler(java.io.InputStream, java.lang.String) found in class StreamGobbler.
    StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR");
    ^
    An error occurred between lines: 36 and 86 in the jsp file: /casl/LocalApp/VehicleServiceStmt/AAA.jsp
    Generated servlet error:
    D:\Tomcat\work\localhost\_\casl\LocalApp\VehicleServiceStmt\AAA$jsp.java:121: No constructor matching StreamGobbler(java.io.InputStream, java.lang.String) found in class StreamGobbler.
    StreamGobbler outputGobbler = new StreamGobbler(proc.getInputStream(), "OUTPUT");
    I am unable to determine the reason of why the constructor which exists in the StreamGobbler Class is not recevied in JSP. If I try to write the same code in JSP as a JAVA class, keeping StreamGobler class same, the programme executes successfully.
    Please help me find solution to this at the earliest. Thanks in advance,
    Prachi

    Thanks,
    I got it working by making the constructor Public.
    -Prachi

  • Executing java.class files

    From julesh1
    To whom may help me:
    I'm new to java.
    I'm currently using jdk1.4.
    I can compile File.java just fine.
    But when i try to execute File.class i get an error message saying
    java.lang.noclassDefFoundError.
    This did not happen before.
    any help would greatly be appreciated.

    when you receive that error it usually indicates that the CLASSPATH does not include the directory where you are saving your .class files. If you are using Windows 2000, you need to:
    1. Right click on My Computer
    2. Go to properties
    3. Click on the Advance tab
    4. Click on Environment Variables
    5. Edit or create a new variable named ClassPath and type in something similar to this:
    .;C:\java;C:\jdk1.3.1;
    If you have Windows 95 or 98,
    Click on Start, then Run and type in sysedit, then click OK.
    Go to the AUTOEXEC.BAT file which usually is the first file to pop up. Type:
    SET CLASSPATH=.;C:\jdk1.3.1\classes;c:\java
    In the above . is the current directory; c:\jdk1.3.1\classes is a place where you can store your class files; c:\java is a directory I created on my hard drive where I store my class files..
    I hope this helps,
    Kent

  • Execute Java class on startup of OC4J

    So this might not even be possible in OC4J. But is there any way I can specify a Default Run Target for an OC4J container on an application server, similar to how you can specify a Default Run Target on JDeveloper. I want to execute a java class every time the OC4J server starts up.
    But here's the basic issue:
    1) I have a multi-threaded application that runs on an Oracle 10gR2 application server (in OC4J).
    2) The program has an automated portion of it that runs in its own thread in the background - right now I manually launch this thread with a request to a servlet
    3) When OC4J restarts (say for the monthly server reboot, etc) is there any way I can have OC4J launch that thread for me
    Basically its encapsulated in a runner.class's main() which does all work of setting up the application. This way we don't have to manually do it. I've tried modifying the command line arguments in the IAS Console so that it does something like:
    $ORACLEHOME/jdk/bin/java -classpath $ORACLE_HOME/j2ee/MyApp1/applications/MyApp1/webapp1/WEB-INF/classes:$ORACLE_HOME/jlib/MyStandard.jar -Djava.security.policy=/a0111/oracle/oraBI1/j2ee/MyApp1/config/java2.policy -Djava.awt.headless=true MyApp1.runner
    However that leads me down class path hell of having to declare every class used by the OC4J container.
    Thanks for all the help.

    You can use a LifeCycle listener, which can be loaded using the configuration file. I forget the exact XML element, but it's available in virtually every level of the configuration.
    However with a stub for native code the usual trick is to load the library in a static initializer, which will cause it to be loaded the first time the class is actively used. That's less hastle.

  • Name Clash with Java Class

    I have a web dynpro track.  In my DC I use a java class that is in the src/packages directory.  Somehow the connection between my SpiritCalendar.java class on my PC and the one in the repository have come apart.  The repository browser shows the SpiritCalendar.Java class with the local house symbol next to it and the words SpiritCalendar.java <Name Clash>. 
    The differences between the two versions is just one method so I'm not scared of deletes. Natually, this is stopping the build since I use the new method.
    Any guidance on how to fix this?
    Diane

    I just tried to do an Edit File in this Folder from my UTIL folder.  The other Java Class checked out fine.  The SpiritCalendar class gave a  Sync Failed due to the name clash
    08:25:57.693  SYNC  (FAILED: File has local-remote name clash)  SpiritCalendar.java
      (D:\NWDI Development Configuration\4\DCs\spiritaero.com\cats\emp\timevrfy\_comp\src\packages\com\spiritaero\cats\empl\util\SpiritCalendar.java)
         08:38:59.360  SUCCEEDED: Created activity act_w_MTEHRC2_spiritaero_2e_com_MTE_2d_CATS_2d_CUSTOM_dev_inactive_u_s0002916_t_2009_01_30_14_38_59_GMT_de7d6ee2-3a90-4d19-92ee-9f0873308fff
         08:39:01.172  EDIT  (SKIPPED: File is local-only)  SpiritCalendar.java  
    (D:\NWDI Development Configuration\4\DCs\spiritaero.com\cats\emp\timevrfy\_comp\src\packages\com\spiritaero\cats\empl\util\SpiritCalendar.java)
         08:39:01.469  EDIT  StringUtility.java   (D:\NWDI Development Configuration\4\DCs\spiritaero.com\cats\emp\timevrfy\_comp\src\packages\com\spiritaero\cats\empl\util\StringUtility.java)
         08:39:02.110 ==> Finished in 985ms. 1 file succeeded (8428 bytes). 1 file skipped (51066 bytes).

  • Scheduled job throws Class Not Found error when executing Java class

    Hi,
    I have written a java class to carry out a file upload to an external site and put the class on our server.
    I also wrote a script to call this java class, passing inthe relevant parameters.
    If i call the script using the ./ syntax from SSH it runs file logged in as Root and Oracle.
    I the setup a scheduled job to call this script but the job fails with the error...
    STANDARD_ERROR="Exception in thread "main" java.lang.NoClassDefFoundError: HttpsFileUpload Caused by: java.lang.ClassNotFoundException: HttpsFileUpload at java.net.URLClassLoader$1.run(URLClassLoader.java:"I cannot understand why it is raising the error if it runs from SSH.
    O/S = Red Hat Enterprise Linux ES, oracle version = 10.2.0.1.0
    Any help or guidance would be appreciated
    Thank you in advance
    Graham.
    Edited by: gpc on Feb 4, 2009 12:46 PM

    Hi,
    See this link for some tips if you haven't yet :
    Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
    I can think of two things. Your script may not be able to run as the nobody user (by default external jobs run as the nobody user). Or your script might require that some environment variable be set (by default environment variables are not set in external jobs).
    Maybe you need to set the CLASSPATH variable in your script before calling java ?
    Hope this helps,
    Ravi.

  • Executing java class through servlet

    Hi,
    I am facing one problem and would be glad if I could get an input.
    I'm working on admin module and want to execute some java program which may take 10mins. for execution through either JSP or Servlet. DO any of you know how this could be done ?
    thanks
    Amit.

    Do you mean that you want to run a Java class from a servlet and wait till that class finishes off?

  • I can't give in my name and password

    i logged out on skype an hour ago or something(normally it is always logged in), and now when i want to log back in, it shows the screen to log in with my skype name, but when i click in the window to enter my password, nothing happens, i can't type anything in the window...so i tried to log in with my microsoft account but there i can't type nor my e-mail, nor my password... help?

    What version of Windows are you on (XP, Vista, Windows 7, Windows 8 )? Is it 32-bit or 64-bit? http://support.microsoft.com/kb/827218 What is the version of Internet Explorer installed on your computer? In Internet Explorer go to Help -> About Internet Explorer. P.S. Please, don’t say that you are not using Internet Explorer. This is irrelevant. Skype depends on Internet Explorer. 

  • How can i give 2 different names for the same attribute in querypannelVC

    Hi
    I have a View criteria and exposing as a query panel.In the VC, we are using one VO attribute instance twice"FullName".We have a requirement of display 2 different names for this attribute in the query panel Ui.Attached the VC screenshot.
    Ex:Present in the Query panel Ui fields are displaying like
    FullName
    FullName
    Requirement:
    Owner
    Assignee
    Thanks in Advance,
    Naga

    Hi Thanks for the reply..So are you saying like add the same "FullName" attribute twice with different Alias Names(Owner,Assignee) ?But here we are having the FullName as common and depends upon role we are displaying "Owner" or "Assignee".If i create two instances for same attribute will it not be like redundancy ?

  • 2 years aggo i think there was this browser with a Rocket icon or something like that. The developing was from Mozzila. Can you give me the name of this project

    There was a link on mozilla web page. The link was located on the bottom of the page, but it seams that its no longer there

    The only browsers from mozilla.org has been Firefox and the SeaMonkey suite.

  • Specifying a process name for a java application

    Hi,
    we run multiple java applications on our Windows 2003 server. It is diffucult to monitor these processes as they all appear as "java.exe" in the Windows Task Manager > Processes.
    Is there a way to specify a name for such a process? My colleague has suggested creating a copy of java.exe for each process, and then renaming the executable to reflect the name of the application it is starting. I think this method is not very flexible.
    Thank you for your suggestions in advance.

    Is there a way to specify a name for such a process?
    My colleague has suggested creating a copy of
    java.exe for each process, and then renaming the
    executable to reflect the name of the application it
    is starting. I think this method is not very
    flexible.That is the easiest though.
    If you don't like it then I think (as a guess only) that the following is possible.
    1. Create your own java launcher. As long as you don't distribute it you can start with the java source code for this.
    2. Find the Windows API that allows you to change the application name on start up.
    3. Modify the launcher to do this via a command line option.
    Of course there might not be any such API.

  • How can i retrieve a computer name with a java code

    hello friends,
    please, can i get help on how i can rtrieve the name of a computer(any at all) using java - a code will be appreciated.
    i also wish to ask if you know how i can use the JFileChooser class, such that when i click on a file to select it and then click on the open button, the file will open / show in a TextArea which i have already created.
    Moreso, how can i use the JFileChooser to save something i've written in a TextArea, as file to a system.
    thanks in advance for your useful advice. quite grateful.

    'result' is a String I think.
    As for your JFileChooser question...
    Create your take the file returned from JFileChooser, open it in a BufferedReader (I'm assuming it's text as you want to display it in a JTextArea) then read the lines out.
    JFileChooser fc = new JFileChooser();
    fc.showOpenDialog(null);
    File file = fc.getSelectedFile();
    if (file != null) {
    try {
    BufferedReader in = new BufferedReader(new FileReader(file));
    String inputLine;
    String total = "";
    while ((inputLine = in.readLine()) != null)
    total+=inputLine;
    in.close();
    textarea.setText(total); // textarea = your JTextArea
    } catch (Exception e) {
    System.err.println("Error: "+e);
    }

Maybe you are looking for