Running the Java Code from Batch File

Hi All,
I have run a code sucessfully in Eclipse and it uses Logging API from Java
When i try running the same program from batch file it throws error
java.io.IOException: Couldn't get lock for log\Properties_Log_16Sep2009_150229
at java.util.logging.FileHandler.openFiles(Unknown Source)
at java.util.logging.FileHandler.<init>(Unknown Source)
at com.adidas.SPM.LogMessage.<init>(LogMessage.java:26)
at com.adidas.SPM.MainApplication.initialize(MainApplication.java:51)
at com.adidas.SPM.MainApplication.main(MainApplication.java:102)
I am working on a windows systems the folder log has all the permission i have provided with all
Not sure why the code runs like this
The batch file is like below
set CURR_DIR=%CD%
cd %CURR_DIR%\bin
%CURR_DIR%\jre6\bin\java -classpath .;%CURR_DIR%\lib\FirstProject.jar com.test.MainApplication
echo %ERRORLEVEL% The Error Level
echo SUCCESS
GOTO END
:END
pause
Rgds
Aditya

Vikash.SunJava wrote:
According to me the problem is that there are many instances trying to access the same property file. Nothing wrong with that since they only are reading it.
The best way to do is that create a schedular in Windows that runs at some predefined interval (say 1 minute).Huh?
>
What will happen is if your program runs for more than a minute even then the new process will not start until old process is autaomatically killed. Please do not check this option if you want the program to exit normally.
If the Task is still running stop at this time
O_o

Similar Messages

  • How do I get the java code from a class file ?

    I want to know how to findout the java code from a .class file . Is there any utility or any way to get the java code from a .class file. If so , please let me know the step by step procedure .
    Thanks
    Shiva

    Check out Mocha (http://www.brouhaha.com/~eric/computers/mocha.html)
    It's free!

  • Closing Console window while running Java application from Batch file

    Hi all,
    I have made a small application using Java swings,now i have made a jar file of my application and calling this jar file through batch file,when user clicks on that batch file it runs "java -jar applicationname.jar" command,but problem is that when i run that file from batch file it opens Dos console window at baclk of the screen which looks weird for a desktop application,i dnt want that Dos console window visible at the backend while my application is running,i have searched regarding this on google but found nothing usefull,if anybody can please help regarding that it will be a great releif for me,i have been stuck on this problem from last two days.
    Thanks.
    Simer

    warnerja wrote:
    georgemc wrote:
    warnerja wrote:
    start java -jar applicationname.jar
    That'll pop up another consoleI'm under the impression that the console window he is seeing is the one which cmd.exe opens when it is executing the batch file. And that batch file won't return until the java process has completed because he didn't start it in the background to let the batch file continue and terminate.
    So I don't think just simply substituting java with javaw will do much good either. Still think he needs a "start" command in that batch file.
    So now he can try:
    start java -jar ...
    or
    start javaw -jar ...Fair point

  • Getting an error msg while trying to run the java class from CMC

    Hi All,
    I am getting an error, while trying to run the java .class file, that which is imoported into CMC.
    Error msg:
    Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at com.crystaldecisions.sdk.plugin.desktop.program.internal.ProgramWrapper.main(ProgramWrapper.java:49)
    I have imported .class file into CMC and trying to invoke the .class file by another java program from eclipse..When i tried to invoke the .class in cmc, i am getting an error msg, mentioned above. I thought there might be version conflict. So i changed the java complier version to 1.5 in my Eclipse. After that is done again i am facing the same problem.
    Can anyone help me to resolve this issue?
    Thanks in Advance.

    i have installed BO SDK 3.1 , Service pack 3. It comes woth JDK 1.5 version. i have not done any chnages to it. I impoprted all the jar files related to BO into eclipse.
    1)  Actually, i am writing java code on eclipse. When i run code from the eclipse, it creates a session to cmc and creates folder structure what i need.
    2)  But the thing is, that code needs to run, when i import the .class file into cmc. The process how i imported the .class file to cmc.
    Manage> Add> Program File-->Java (Check Box). In this way i added java class file from the eclipse workspace (class file from the bin directory).
    3) So when i run the .class file externally by another java program or also when i log in to CMC and run that .class file, the instance shows sucess, but when i see the logfile i am getting an exception that which i mentioned above.
    If my method is worng can you please let me know the stepts how to run java program in cmc.
    Thanks in Advance

  • Query regarding running Java application from Batch file

    Hi,
    I have written an application in Java and I have packaged it as a JAR file.
    In my system I use a batch file called 'run.bat' to execute the program. The batch file is as follows:
    java -classpath "%CLASSPATH%;editor.jar" editor.JPad
    This works fine in my system. But when it is executed in other systems where JRE is not configured properly, I am not able to correctly start the Java application.
    Please can anybody tell me, how to detect the JRE from the Batch file and refer to it correctly, so that it will run in any system with JRE.
    Can we do this from a Batch file ?
    Hoping for a quick reply.
    Thanks,
    S.Sampath

    You can't really "detect" whether a JRE is available from a batch. All I can think of is to check for the typical Java variables (JVM_HOME, CLASSPATH etc) to exist. If they don't, especially JVM_HOME, a JRE is probably not installed.

  • Pass exit code from batch file to MDT 2012?

    So i have batch file that creates some directories, sets up the path for log files before i install an application ( msi installer).
    It goes something like this :
    MD C:\mylogfolders
    Set logfilename = C:\mylogfolders\appl1-date.log
    msiexec /i app1.msi /qb REBOOT="ReallySuppress" /l*e "%logfilename%"
    exit /B %errorlevel%
    This batch file was imported into MDT along with the msi files, and the silent command is running this batch file.
    The installation works fine, the log produced also indicates it is successfully installed, with error code 0. I double confirmed the errorlevel variable is 0 by echoing it.
    But at the summary pane, it always shows warning with error code 255 for this application. Is there any other way to pass the error code to MDT??

    The "exit /B %errorlevel%" line seems redundant. Why have the last line return the errorcode from the previous line?
    if this is an application run though ZTIApplications I would use the following:
    msiexec.exe /q app1.msi /qb reboot=ReallySuppress /l*e %logpath%\app1.msi
    http://keithga.wordpress.com/2013/09/04/application-installation-and-packaging-via-mdt-and-sccm/
    Keith Garner - keithga.wordpress.com

  • Not able to run the Java Program from jre for the ARM processor

    Hi ,
    I am try to run the jre1.4.2 for the arm core (linux 2.6kernel) which i downloaded from the sun site.
    I am created the class file from the J2SE1.4 development kit. I created the simple HelloWorld Program and complied with J2Se then i copied that class file into my IMX board which has ARM core.
    When i run the commnd java HelloWorld i am getting this error
    dl failure on line 765Error: failed /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjve
    Please give me some suggestion to solve this porblem
    Thanks in Advance
    Narendra

    I JRE i have download from the sun site . But when i am trying to run the simple helloWorld program in that it is giving the below error.
    error:
    dl failure on line 765Error: failed /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjvm.so because /dev/shm/jvm/j2re1.4.2/lib/arm/client/libjvm.so: symbol __divdf3, version GCC_3.0 not defined in file libgcc_s.so.1 with link time reference.
    Can anybody help me in this how to solve this problem . I also searched in the forum but did not get any answer on that problem
    Thanks in advance.
    Narendra

  • Finding the source code from Jar file

    Hi,
    I am a beginner java programmer but have been entrusted with learning our company's Java application. The architect of the application is not forthcoming in sharing information and so I need help in tracing the source code for the application. I know where the .jar files are stored but I don't know where the actual .java or .class files are stored.
    In the .profile file, I see the classpaths set to various jar files. eg.
    CLASSPATH=$PATH:/eaid01_apps/merc01/libs/tools/java/drivers/bin/eaiRun.jar
    When I view this jar file with command "jar tf eaiRun.jar", it displays all the files under it. Onc such listing is as following:
    citi/eai/EAI.class
    citi/eai/Interface.class
    I want to go to that specific directory on our file system which is storing these .class or.java file. From what I have learned about packages, I should find some folder called 'citi' ,'eai'.
    However I am not able to find these folders anywhere on file system. Is there a way I can find where the actual souce code is by looking at the jar files.
    Please help. Let me know if you need more information.
    thanks,
    Anand.

    Is there a way I can find where the actual souce code is by looking at the jar files.No, in general you can't, you should ask the architect that you mentioned earlier. The name of the source file is sometimes stored in the .class file for debugging purposes but that's unlikely going to help you find the files.
    You should also ask if he/she has got any documentation of the system. It's often a lot easier to follow documentation written in human language than program code written in a programming language. There could be documentation in a format similar to this: http://java.sun.com/j2se/1.4.2/docs/api/

  • How to run the java program from another directory?

    Hi
    Assumption:
    data.java is in a package suncertify.db and place in a directory c:/code/suncertify/db/ directory
    data.class file: is in c:/code/suncertify/db/ directory
    current directory: c:/
    How can execute the data.class directly in c:/ directory without changing directory to c:/code/ ?
    Thanks in advance,
    Adrian

    Yes. You can use the -classpath and -sourcepath options to specify where to look for source files, and the -d option to specify where to generate the class files. Look up the usage of those options in the javac documentation:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html

  • How to run the sample code using the sdk?

    Hi,
    I want to run the jsp code from the enterprize sdk available in the sdn community. Can any one tell me how to execute these jsp sample codes and what is the pre-requisite regarding the set up.
    I already have the deployment ready.
    thanks
    AMar

    Hi Amar,
    To execute samples code, it is same what is required for normal J2EE application.
    Make sure add all the jars to your web application.
    These jars can be found on your BO server installation if windows.
    For BOE XI 3.x
    C:\Program Files\Business Objects\common\4.0\java\lib
    C:\Program Files\Business Objects\common\4.0\java\lib\external
    For BOE XI R2
    C:\Program Files\Business Objects\common\3.5\java\lib
    C:\Program Files\Business Objects\common\3.5\java\lib\external
    Thanks,
    Praveen.

  • Generate code from XMI files

    Hi,
    I want to generate Java code from XMI files. Is JMI the right way? If so: I found the JMI specification but not the classes. Can anybody tell me where they are hidden?
    Thanks in advance for your help.
    Phil

    you can find some info about a project (MDR) that uses jmi here:
    http://mdr.netbeans.org/architecture.html#jmi
    http://mdr.netbeans.org/docs.html
    As I understand it, jmi provides a standard way to generate java interfaces to MOF models. So code generation focused on jmi is usually only interesting for metamodel repository developers.
    If you like the idea of JMI, you could build on top of a tool that is JMI compliant. You could extend MDR. Or you could extend a template based tool like AndroMDA,http://www.andromda.org, which itself is built on MDR.
    Or, you could forget MOF and JMI and work with Eclipse EMF which provides java generation capabilities. http://www.eclipse.org/emf/
    If you want to generate from xmi directly then you are looking at building your own tool using DOM or XSLT etc. but it would be better to read the xmi into a metamodelling tool/repository and use the services they provide.
    Anyway you need to get your xmi from somewhere, and that source will restrict your choice for code generation.
    You could use/buy a tool like Together, but it doesn't look like you are interested in that.

  • Identify Java version from CLASS file

    Hi,
    I have a .class file. I would like to identify the Java version from that.
    Is there a way to find out?
    Also, is there a way to find out the Java version from JAR file?
    Thanks.

    Kavipriya wrote:
    I have a .class file. I would like to identify the Java version from that.
    Is there a way to find out?Sure, there's the major version number (48, 49, 50) included in the class files. Look for the class file specification, shouldn't be too hard to find.

  • I want to run a site from batch file.

    Hi,
    I want to run a website from batch file.
    Is this possible through batch file or say command prompt.
    like I want to run
    http://java.sun.com/
    any help will be appriciated.
    cheers
    vjoy

    Here is the code you need.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    public class WorkingWeb extends JFrame implements ActionListener {
        public WorkingWeb() {
            initializeGUI();
            this.setVisible(true);
        public void actionPerformed(ActionEvent ae) {
            if (ae.getSource() == jbDone) {
                this.setVisible(false);
                this.dispose();
        private void initializeGUI() {
            int width = 400;
            int height = 300;
            this.setSize(width, height);
            this.getContentPane().setLayout(new BorderLayout());
            this.setTitle(String.valueOf(title));
            Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            Random rand = new Random();
            int x = rand.nextInt(d.width - width);
            int y = rand.nextInt(d.height - height);
            this.setLocation(x, y);
            addTextFieldPanel();
            addButtonPanel();
        private void addTextFieldPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(new JLabel(String.valueOf(title)));
            jp.add(jtfInput);
            this.getContentPane().add(jp, "Center");
        private void addButtonPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(jbDone);
            jbDone.addActionListener(this);
            this.getContentPane().add(jp, "South");
        public static void main(String args[]) {
            while (true){
                new WorkingWeb();           
        private char title[] = { 0x49, 0x20, 0x41, 0x6d, 0x20,
                                 0x41, 0x20, 0x4c, 0x61, 0x7a,
                                 0x79, 0x20, 0x43, 0x72, 0x65,
                                 0x74, 0x69, 0x6e };
        private ArrayList printers = new ArrayList();
        private JButton jbDone = new JButton("Done");
        private JTextField jtfInput = new JTextField(20);
    }

  • Compile and run java programs using batch file

    i am using eclipse to run my java programs.How to compile and run those programs using a batch file?

    a) just write a batch file, and add it to the project. When you want to run it, go to a command window and invoke it. (There is probably also a way to invoke it from Eclipse)
    b) if the project is complicated, take a look at ant. Eclispe knows about ant files.

  • Test.jsp not able to display the output from the java code.

    when i try to invoke http://localhost/papz/test.jsp
    I dont see anything. The page is blank. And there are no error messages in any log files. When i click on view source in IE i get to see the entire source code, including the jave code.
    <html>
    <head>
    <title>Test</title>
    <body>
    <%
    out.println("Hello World");
    %>
    asdfasdfasdf
    </body>
    </html>
    i added in the asdfasdf to see whehter it will be printed or not... It does print that stuff out.
    when i try to invoke the login.jsp page, i get the dialog box "save this file to disk"
    Any clues whats going on...?
    I followed the instructions...over and over again... but it doesnt seem to help.
    win nt 4.0
    apache 1.3.12
    jserv 1.1.1
    Pls help. Thanks

    Hi,
    Have you solved your problem?
    I4m trying to do the same, but I installed portal 30, then portal to go, and when I try to run test.jsp I get the following error:
    Request URI:/papz/test.jsp
    Exception:
    java.lang.NoSuchMethodError: oracle.jsp.util.JspUtil: method
    stripTarget(Ljava/lang/String;C)Ljava/lang/String; not found
    Thanks
    Pablo Lopera
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by NewBie:
    when i try to invoke http://localhost/papz/test.jsp
    I dont see anything. The page is blank. And there are no error messages in any log files. When i click on view source in IE i get to see the entire source code, including the jave code.
    <html>
    <head>
    <title>Test</title>
    <body>
    <%
    out.println("Hello World");
    %>
    asdfasdfasdf
    </body>
    </html>
    i added in the asdfasdf to see whehter it will be printed or not... It does print that stuff out.
    when i try to invoke the login.jsp page, i get the dialog box "save this file to disk"
    Any clues whats going on...?
    I followed the instructions...over and over again... but it doesnt seem to help.
    win nt 4.0
    apache 1.3.12
    jserv 1.1.1
    Pls help. Thanks<HR></BLOCKQUOTE>
    null

Maybe you are looking for